useSwitch
Provides the behavior and accessibility implementation for a switch component. A switch is similar to a checkbox, but represents on/off values as opposed to selection.
note
React Native has a Native Switch component. You may only need this hook If you're building a custom Switch.
Install#
- Yarn
- npm
Import#
API#
AriaSwitchProps#
- Props for the switch.
ToggleState#
- State for the switch, as returned by useToggleState.
ref#
- Ref of input element or Pressable/Touchable