( props: AriaSwitchProps, state: ToggleState, ref: RefObject<HTMLInputElement | null> )
| 58 | * @param ref - Ref to the HTML input element. |
| 59 | */ |
| 60 | export function useSwitch( |
| 61 | props: AriaSwitchProps, |
| 62 | state: ToggleState, |
| 63 | ref: RefObject<HTMLInputElement | null> |
| 64 | ): SwitchAria { |
| 65 | let {labelProps, inputProps, isSelected, ...states} = useToggle(props, state, ref); |
| 66 | |
| 67 | return { |
| 68 | labelProps, |
| 69 | inputProps: { |
| 70 | ...inputProps, |
| 71 | role: 'switch', |
| 72 | checked: isSelected |
| 73 | }, |
| 74 | isSelected, |
| 75 | ...states |
| 76 | }; |
| 77 | } |
no test coverage detected