import { Switch as ChakraSwitch } from '@chakra-ui/react'; import * as React from 'react'; export interface SwitchProps extends ChakraSwitch.RootProps { inputProps?: React.InputHTMLAttributes; labelProps?: ChakraSwitch.LabelProps; rootRef?: React.Ref; trackLabel?: { on: React.ReactNode; off: React.ReactNode }; thumbLabel?: { on: React.ReactNode; off: React.ReactNode }; } export const Switch = React.forwardRef( function Switch(props, ref) { const { inputProps, children, rootRef, trackLabel, thumbLabel, labelProps, ...rest } = props; return ( { thumbLabel && ( { thumbLabel?.on } ) } { trackLabel && ( { trackLabel.on } ) } { children != null && ( { children } ) } ); }, );