Navigation
View mode toggle switch
View mode toggle switch: A two-state switch that flips a view between two named modes, with a sliding thumb that shrinks under a press and swaps a small icon inside it.
Using View mode toggle switch
View mode toggle 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.
| Control | Type | Default | Preview limits |
|---|---|---|---|
checked | boolean | false | No additional limit in the metadata. |
onLabel | text | Grid | Up to 16 characters |
offLabel | text | List | Up to 16 characters |
accent | color | #38BDF8 | No additional limit in the metadata. |
Which frameworks are available for View mode toggle switch?
View mode toggle 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 View mode toggle switch depend on?
The React metadata lists these npm dependencies beyond React: motion, clsx.
What accessibility details are visible in View mode toggle switch?
The React source for View mode toggle switch includes: attributes and handlers (aria-checked, aria-hidden, aria-label); explicit roles (switch). These are source observations. Verify accessible names, focus order and keyboard behavior in the composed page.
How does View mode toggle switch handle reduced motion?
View mode toggle switch reads the motion preference in its React source through useReducedMotion(). Preference-dependent expressions in index.tsx: duration: reduceMotion ? 0 : 0.14; duration: reduceMotion ? 0 : 0.18; spring: reduceMotion ? { duration: 0 } : { type: "spring" as const, stiffness: 560, damping: 34 }. Check the full implementation, shared styles and selected port with reduced motion enabled; these observations do not establish that every animation stops.