Skip to content
Menu

Inputs

Spring layout toggle

Spring layout toggle: A switch whose knob is aligned to one end of the track by layout alone and springs between the two measured positions whenever the state flips.

Using Spring layout toggle

Spring layout toggle 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
onbooleanfalseNo additional limit in the metadata.
bouncenumber0.3From 0 to 0.7; step 0.05
sizenumber50From 36 to 72; step 2
labeltextFocus modeUp to 24 characters
accentcolor#9BE15DNo additional limit in the metadata.
Which frameworks are available for Spring layout toggle?

Spring layout toggle 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 Spring layout toggle depend on?

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

What accessibility details are visible in Spring layout toggle?

The React source for Spring layout toggle 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 Spring layout toggle handle reduced motion?

Spring layout toggle reads the motion preference in its React source through useReducedMotion(). Preference-dependent expressions in index.tsx: faceTransition: reduced ? { duration: 0.15 } : { duration: 0.55, times: [0, 0.35, 1], ease: "easeOut" as const }; travelTransition: reduced ? { duration: 0.18, ease: "linear" as const } : { type: "spring" as const, bounce, duration: 0.5 }. 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