Skip to content
Menu

Inputs

Sliding Thumb Switch

Sliding Thumb Switch: An on/off switch built from a hidden checkbox: a pill track that recolors and a round thumb that slides to the opposite edge.

Using Sliding Thumb Switch

Sliding Thumb Switch uses the inline preview frame with a light/dark theme setting.

Customize the preview

These controls are passed to the demo. Defaults and limits describe the preview; consult the implementation for its full prop API.

ControlTypeDefaultPreview limits
checkedbooleanfalseNo additional limit in the metadata.
accentColorcolor#2F5FD0No additional limit in the metadata.
disabledbooleanfalseNo additional limit in the metadata.
Which frameworks are available for Sliding Thumb Switch?

Sliding Thumb Switch is available for React, Vue, Svelte, Astro, HTML. The live preview uses React; the source observations below apply to index.tsx. Check the selected port before relying on the same interactions.

What does Sliding Thumb Switch depend on?

The React metadata lists these npm dependencies beyond React: motion, clsx.

What accessibility details are visible in Sliding Thumb Switch?

The React source for Sliding Thumb Switch includes: native elements (input, label); attributes and handlers (aria-hidden, aria-label, onKeyDown); key comparisons (Enter). These are source observations. Verify accessible names, focus order and keyboard behavior in the composed page.

How does Sliding Thumb Switch handle reduced motion?

Sliding Thumb Switch reads the motion preference in its React source through useReducedMotion(). Preference-dependent expressions in index.tsx: move: reduced ? { duration: 0 } : { duration: 0.22, ease: [0.4, 0, 0.2, 1] }; transitionDuration: reduced ? "0ms" : "220ms". Check the full implementation, shared styles and selected port with reduced motion enabled; these observations do not establish that every animation stops.

Connect your agent

Related open components