Toggle
Disabled
Disabled uncheck
Disabled checked
<script lang="ts">
let on = false
let on2 = true
</script>
<CToggle bind:value={on} label="Disabled uncheck" disabled />
<CToggle bind:value={on2} label="Disabled checked" disabled />
<script lang="ts">
let on = false
let on2 = true
</script>
<CToggle bind:value={on} label="Disabled uncheck" disabled />
<CToggle bind:value={on2} label="Disabled checked" disabled />
svelte
Click fold/expand code
Sizes
xs
sm
md (default)
lg
xl
<script lang="ts">
let on = 'md'
</script>
<div class="c-flex c-items-center c-gutter-md c-wrap">
<div>
<CToggle bind:value={on} label="xs" checkedValue="xs" />
</div>
<div>
<CToggle bind:value={on} label="sm" checkedValue="sm" />
</div>
<div>
<CToggle bind:value={on} label="md (default)" checkedValue="md" />
</div>
<div>
<CToggle bind:value={on} label="lg" checkedValue="lg" />
</div>
<div>
<CToggle bind:value={on} label="xl" checkedValue="xl" />
</div>
</div>
<script lang="ts">
let on = 'md'
</script>
<div class="c-flex c-items-center c-gutter-md c-wrap">
<div>
<CToggle bind:value={on} label="xs" checkedValue="xs" />
</div>
<div>
<CToggle bind:value={on} label="sm" checkedValue="sm" />
</div>
<div>
<CToggle bind:value={on} label="md (default)" checkedValue="md" />
</div>
<div>
<CToggle bind:value={on} label="lg" checkedValue="lg" />
</div>
<div>
<CToggle bind:value={on} label="xl" checkedValue="xl" />
</div>
</div>
svelte
Click fold/expand code
CToggle Props
- labeldefault:
string
The toggle label text. It is recommended to use
bind:value
. - sizedefault:
'xs' | 'sm' | 'md' | 'lg' | 'xl'=
undefined
The size of toggle. Notice that the default value is
'md'
instead ofundefined
- valuedefault:
any
false
The current value of toggle.
- checkedValuedefault:
any
true
The value passed to
value
prop when the toggle is on. - uncheckValuedefault:
any
false
The value passed to
value
prop when the toggle is off. - disableddefault:
boolean
false
Determine whether the toggle is dislabed or not.
CToggle Events
No data
CToggle Slots
No data
CToggle Exports
No data
On this page