Skip to main content

Switch

A boolean on/off toggle.

import { Switch } from '@jbpark/ui-kit';

<Switch checked={checked} onChange={setChecked} />;
checked
ONOFF

Props

PropTypeDefault
checkedboolean-
defaultCheckedbooleanfalse
size'small' | 'medium''medium'
disabledboolean-
onChange(checked: boolean) => void-
checkedChildrenReactNode-
unCheckedChildrenReactNode-
classNames{ track?: string; handle?: string }-
classNamestring-

Works both controlled (pass checked + onChange) and uncontrolled (pass defaultChecked, or neither). Switch also accepts the rest of React.ComponentPropsWithoutRef<'button'> except onChange (renamed to the boolean-callback form above).