Park UI

Radio Group

A form control for selecting one option from multiple radio choices.

Installation

Usage

Info

If you prefer a closed component composition, check out the snippet below.

Examples

Controlled

Pass the value and onValueChange props to the RadioGroup.Root component to control the selected radio button.

Colors

Pass the colorPalette prop to the RadioGroup.Root component to change the color scheme of the component.

Sizes

Pass the size prop to the RadioGroup.Root component to change the size of the radio component.

Disabled

Pass the disabled prop to the RadioGroup.Item component to make the radio disabled.

Closed Component

Here's how to setup the Radio for a closed component composition.

Here's how to use it:

Props

Root

PropDefaultType
variant'solid'
'solid'
size'md'
'sm' | 'md' | 'lg'
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

defaultValue
string

The initial value of the checked radio when rendered. Use when you don't need to control the value of the radio group.

disabled
boolean

If `true`, the radio group will be disabled

form
string

The associate form of the underlying input.

id
string

The unique identifier of the machine.

ids
Partial<{ root: string label: string indicator: string item: (value: string) => string itemLabel: (value: string) => string itemControl: (value: string) => string itemHiddenInput: (value: string) => string }>

The ids of the elements in the radio. Useful for composition.

name
string

The name of the input fields in the radio (Useful for form submission).

onValueChange
(details: ValueChangeDetails) => void

Function called once a radio is checked

orientation
'horizontal' | 'vertical'

Orientation of the radio group

readOnly
boolean

Whether the checkbox is read-only

value
string

The controlled value of the radio group

Item

PropDefaultType
value*
string
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

disabled
boolean
invalid
boolean