/* This example requires Tailwind CSS v2.0+ */ import { Switch } from '@headlessui/react' import clsx from 'clsx' export default function ShortToggle(props: { on: boolean setOn: (enabled: boolean) => void disabled?: boolean onChange?: (enabled: boolean) => void }) { const { on, setOn, disabled } = props return ( { setOn(e) if (props.onChange) { props.onChange(e) } }} className={clsx( 'group relative inline-flex h-5 w-10 flex-shrink-0 items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2', !disabled ? 'cursor-pointer' : 'cursor-not-allowed opacity-50' )} > Use setting ) }