Radio
Radio.
#
When To Use- Used to select a single state in multiple options.
- The difference between Select is that Radio is visible to user and can facilitate the comparison of choice, which makes there shouldn't be too many of them.
#
Examples#
Radio#
Basic#
Use with FormFieldthis is a required field
#
Disabled#
RadioGroup#
Basic#
Controlled#
Composition render#
Direction#
Use with FormFieldShould press yes
#
API#
RadioProperty | Description | Type | Default |
---|---|---|---|
checked | Specifies whether the Radio is selected | boolean | |
defaultChecked | Specifies the initial state: whether or not the Radio is selected | boolean | |
disabled | Disable Radio | boolean | false |
onChange | The callback function that is triggered when the state changes | (event: ChangeEvent) => void | |
value | The value of radio | string | |
id | The id of radio | string | |
onFocus | (event: FocusEvent) => void | ||
onBlur | (event: FocusEvent) => void |
#
RadioGroupProperty | Description | Type | Default |
---|---|---|---|
direction | to specify the direction of the step bar | 'horizontal' 'vertical' | |
defaultValue | To set the initial value | string[] | |
options | Specifies options | { label: ReactNode; value: string; disabled?: boolean; }[] | |
value | Used for setting the currently selected value | string[] | |
onChange | The callback function that is triggered when the state changes | (value: string[]) => void |