useRadioGroup

Provides the behavior and accessibility implementation for a radio group component. Radio groups allow users to select a single item from a list of mutually exclusive options.

Install#

yarn add @react-native-aria/radio

Import#

import {useRadioGroup, useRadio} from '@react-native-aria/radio'

API#

useRadioGroup(props: AriaRadioGroupProps, state: RadioGroupState): RadioGroupAria
useRadio(
props: RadioAriaProps,
state: RadioGroupState,
ref: RefObject<HTMLElement>
): RadioAria

AriaRadioGroupProps#

Props for the radio group.

RadioGroupState#

State for the radio group, as returned by useRadioGroupState.

RadioGroupAria#

{
/** Props for the radio group wrapper element. */
radioGroupProps: HTMLAttributes<HTMLElement> & AccessibilityProps,
/** Props for the radio group's visible label (if any). */
labelProps: HTMLAttributes<HTMLElement> & AccessibilityProps
}

RadioAriaProps#

RadioAria#

{
/** Props for the input or Pressable/Touchable element. */
inputProps: InputHTMLAttributes<HTMLElement> & AccessibilityProps,
}

ref#

Ref to the HTML input element.

Example#

Last updated on by Nishan