Magnetic Select
betaA honeycomb of round chips: choosing one grows it and magnetically shoves the rest apart, tilted, with a springy settle.
- Forms
- 2 files
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add magnetic-selectnpm packages installed: class-variance-authority.
import { MagneticSelect } from "@/components/ui/magnetic-select";Default
Gallery
With Content
Nineteen
Controlled
Right To Left
<MagneticSelect>
| Prop | Type | Default |
|---|---|---|
options (required)Up to 19 options: a centre, a ring of six and a ring of twelve. Three form a triangle. | MagneticSelectOption[] | — |
bounceOvershoot, 0–100. 0 settles with no overshoot. | number | 55 |
chipSizeChip diameter in px. | number | 44 |
defaultValueInitial value when uncontrolled. | string | — |
disabledDisables every chip. | boolean | false |
giveSpring softness, 0–100. Above 50 the chips take longer to settle. | number | 50 |
nameRenders a hidden input so the value submits with a form. | string | — |
onValueChangeCalled with the newly selected value. | (value: string) => void | — |
pullMagnet strength, 0–100: selected scale, push distance and tilt. | number | 55 |
stroke | boolean | false |
valueControlled selected value. | string | — |
Plus every attribute of <div> except defaultValue, onChange, children, selected.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes