Radial menu
Items fan out on damped springs from a trigger. Built as a standard menu button: roving tabindex, arrow keys walk the ring and wrap, Home and End jump, typing jumps to a label, Escape closes and returns focus to the trigger, and the chosen item is announced through a polite live region. With reduced motion the items appear instantly in place with no spring.
- Spring Physics
- Roving Tabindex
- aria-live
- prefers-reduced-motion
radial-menu
Tab to the plus, press Enter or Space. Arrow keys walk the ring, Home and End jump, type a letter to jump to a label, Escape closes and puts focus back on the plus.
Last chosen
Nothing yet
Focus order
- 1. Reply
- 2. Pin
- 3. Share
- 4. Move
- 5. Archive
- 6. Mute
Menu is closed. Only the highlighted item is a tab stop (roving tabindex).
Focus trail: none yet
Usage
Drop it in
import { RadialMenu } from "@/app/lib/components/radial-menu";<RadialMenu items={[{ id: "copy", label: "Copy" }]} onSelect={(item) => run(item.id)} />API
Props
| Prop | Type | Default |
|---|---|---|
items* | RadialMenuItem[] | — |
labelAccessible name for the trigger and the menu. | string | "Actions" |
radiusDistance from the trigger centre to each item centre, in px. | number | 112 |
startAngleAngle of the first item in degrees. -90 is straight up. | number | -90 |
sweepDegrees covered by the ring. 360 closes the ring; less fans the items across an arc. | number | 360 |
stiffnessSpring stiffness (higher is snappier). | number | 300 |
dampingSpring damping (lower overshoots more). | number | 17 |
staggerMsDelay between one item starting and the next, in ms. | number | 28 |
reducedMotionForce reduced motion on or off. Leave undefined to follow the system setting. | boolean | — |
onSelect | (item: RadialMenuItem, index: number) => void | — |
onActiveChangeFired when keyboard or pointer focus lands on an item (the roving tab stop). | (item: RadialMenuItem, index: number) => void | — |
onOpenChange | (open: boolean) => void | — |
className | string | "" |
Read from the component's source at build time. * required.
Accessibility
Works with
- Cursor
- Reacts to where the pointer is, not just whether it's over the element.
- Touch
- Follows your finger while it's down, then settles a moment after you lift.
- Keyboard
- Focus lights it up the way the cursor does. Every action has a key.
- Reduced motion
- Nothing moves or springs. Colour still answers, without drifting.