Radio Group
Usage
Selected fruit: 1
Apple
Banana
Orange
Peach
<script lang="ts">
let fruit = 1
const options = [
{ label: 'Apple', value: 1 },
{ label: 'Banana', value: 2 },
{ label: 'Orange', value: 3 },
{ label: 'Peach', value: 4 },
]
</script>
<p>
<b> Selected fruit: </b>
{fruit}
</p>
<CRadioGroup bind:value={fruit} {options} />
<script lang="ts">
let fruit = 1
const options = [
{ label: 'Apple', value: 1 },
{ label: 'Banana', value: 2 },
{ label: 'Orange', value: 3 },
{ label: 'Peach', value: 4 },
]
</script>
<p>
<b> Selected fruit: </b>
{fruit}
</p>
<CRadioGroup bind:value={fruit} {options} />
svelte
Click fold/expand code
CRadioGroup Props
- valuedefault:
string | number
Current value. It is recommended to use
bind:value
. - optionsdefault:
Array<{ label: string; value: string | number }>
undefined
The options array.
- sizedefault:
'xs' | 'sm' | 'md' | 'lg' | 'xl'
undefined
The size of all radios in this group.
- gutterSizedefault:
'xs' | 'sm' | 'md' | 'lg' | 'xl'
undefined
The gutter size between each radio.
- validateOnChangedefault:
boolean
true
If this group is in a Form context. Set this prop to
true
will validate current field when selection change.
CRadioGroup Events
No data
CRadioGroup Slots
No data
CRadioGroup Exports
No data