Skip to content

Selection and input

Switch

An immediate on/off. Track and thumb both resize below md.
Available
Ports as-is
Dual breakpoint

Examples

Rendered live from the maintained Storybook story. Lantern stores only the story id and embeds Storybook rather than duplicating the component or its demo.

Switch

Rendered live from Storybook

Storybook must be running for this to load — bun run start:storybook from the monorepo root, or set NEXT_PUBLIC_STORYBOOK_URL to a deployed instance.

Props

The component's public API, read from its TypeScript source. Descriptions come from TSDoc on the prop, so this table cannot drift from the component.

PropTypeDefaultDescription
...propsReact.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>—Native attributes are forwarded to the underlying element, along with the ref.

Reference

Transcribed from the component audit. If this disagrees with the source, the source is right.

Source
src/components/ui/switch.tsx
Portability
Copies across unchanged — only the utils import path moves.
States to cover
uncheckedcheckeddisabledfocus ring
Dependencies
@radix-ui/react-switch
Responsive
Carries a load-bearing max-md: / md: pair. Sign off at both viewports — see the rule.
Notes
38×22 mobile, 32×18 desktop, with a matching thumb translate pair. Must be reviewed at both breakpoints.