Skip to content

RadioGroup

Radio button group for single selection from a list of options. Normalizes various option formats and supports custom value parsing.

Import

typescript
import { RadioGroup } from 'vuiii'

Basic Usage

vue
// Basic usage with string array import { RadioGroup } from 'vuiii'

<RadioGroup v-model="color" :options="['Red', 'Green', 'Blue']" />

Props

PropTypeDefaultDescription
modelValueany-Selected value (v-model)
optionsany[] | Record<string, any>-Options to render as radio buttons
optionLabelstring | ((item) => any)-Key or function to extract the display label
optionValuestring | ((item) => any)-Key or function to extract the option value
optionDisabledstring | ((item) => any)-Key or function to mark an option as disabled
optionDescriptionstring | ((item) => any)-Key or function to extract description text
valueParserValueParser<string>-Custom parser for option values
disabledbooleanfalseDisables all radio options
readonlybooleanfalseRenders the group as read-only
inlinebooleanfalseRenders radio options horizontally
type'string' | 'number' | 'boolean' | 'date''string'Type used to parse option values

Slots

SlotDescription
defaultCustom option content. Props: { option }
symbolCustom radio symbol. Props: { checked, disabled }

Events

The RadioGroup exposes the selected value through v-model (update:modelValue). It emits no other custom events.

More Examples

vue
// With object options and extractors const plans = [ { id: 'free', name: 'Free', info: '0$/month' }, { id: 'pro', name:
'Pro', info: '10$/month' }, { id: 'enterprise', name: 'Enterprise', info: 'Contact us' } ]

<RadioGroup v-model="selectedPlan" :options="plans" option-value="id" option-label="name" option-description="info" />
vue
// Inline layout (horizontal)
<RadioGroup v-model="size" :options="['Small', 'Medium', 'Large']" inline />
vue
// With type parsing
<RadioGroup v-model="quantity" :options="[1, 2, 3, 4, 5]" type="number" />

Storybook

For interactive examples with all variants, see RadioGroup in Storybook.

Released under the MIT License.