useRadioGroupState

Provides state management for a radio group component. Provides a name for the group, and manages selection and focus state.

installyarn add react-stately
version3.17.0
usageimport {useRadioGroupState} from 'react-stately'

API#


useRadioGroupState( (props: RadioGroupProps )): RadioGroupState

Interface#


Properties

NameTypeDescription
isDisabledbooleanWhether the radio group is disabled.
isReadOnlybooleanWhether the radio group is read only.
selectedValuestringnullThe currently selected value.
lastFocusedValuestringnullThe value of the last focused radio.

Methods

MethodDescription
setSelectedValue( (value: string )): voidSets the selected value.
setLastFocusedValue( (value: string )): voidSets the last focused value.

Example#


See the docs for useRadioGroup in react-aria for an example of useRadioGroupState.