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 | numberCurrent value. It is recommended to use
bind:value. - optionsdefault:
Array<{ label: string; value: string | number }>undefinedThe options array.
- sizedefault:
'xs' | 'sm' | 'md' | 'lg' | 'xl'undefinedThe size of all radios in this group.
- gutterSizedefault:
'xs' | 'sm' | 'md' | 'lg' | 'xl'undefinedThe gutter size between each radio.
- validateOnChangedefault:
booleantrueIf this group is in a Form context. Set this prop to
truewill validate current field when selection change.
CRadioGroup Events
No data
CRadioGroup Slots
No data
CRadioGroup Exports
No data