UNPKG

@gluestack-ui/core

Version:

Universal UI components for React Native, Expo, and Next.js

17 lines 583 B
import { useToggle } from '@gluestack-ui/utils/aria'; import { mergeProps } from '@react-aria/utils'; export function useSwitch(props, state, ref) { let { inputProps } = useToggle(props, state, ref); let { isSelected } = state; return { inputProps: mergeProps(inputProps, { 'role': 'switch', 'checked': isSelected, 'accessible': true, 'aria-checked': isSelected, 'aria-disabled': props.isDisabled, 'aria-readonly': props.isReadOnly, }), }; } //# sourceMappingURL=useSwitch.js.map