Originals
CreativeJelly Switch
The knob stretches as it travels, squashes when it lands and wobbles before settling. Holding it squeezes it. For settings with personality.
Install
Included with Creative: needs your API key. Initialize and log in once.
npx @galactrex/ui add jelly-switchUsage
import { JellySwitch } from "@/components/galactrex/jelly-switch";
<JellySwitch label="Sound effects" showLabel defaultChecked />Source
Installs to components/galactrex/jelly-switch.tsx, with the shared motion primitives beside it.
Source for this component comes with its plan. Install it with the command above, or open your licensed copy here.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | What it switches. |
checked / defaultChecked | boolean | — | Controlled or initial state. |
onChange | (checked: boolean) => void | — | Called on toggle. |
disabled | boolean | — | Disables it. |
showLabel | boolean | false | Show the label beside it. |
className | string | — | Extra classes for the outer element. |
Variants
- Setting. With a visible label in a list.
- Bare. Label for assistive tech only.
Accessibility
- role=switch with aria-checked; Space and Enter toggle it.
Motion and reduced motion
- Spring travel plus squash-and-stretch keyframes on the knob.
- Reduced motion: it slides without the wobble.