Micro-interactions

Radial Menu

Press and hold anywhere and the options fan out from the point you pressed. Selection is resolved from the pointer's angle rather than by hit-testing the options, so every target is an infinite wedge — commit to a direction and you can throw the pointer as hard as you like and still land it.

Install

bun add motion clsx tailwind-merge

Then copy 2 files into your project:

  • components/registry/radial-menu/radial-menu.tsx
  • lib/utils.ts

Props

PropTypeDefaultDescription
radiusnumber96How far the options sit from the press point. Only the drawing distance — selection is angular, so a wide radius costs nothing in accuracy and a tight one buys none.
startAnglenumber180Where the first option lands. 0 is right and 90 is down, following screen coordinates rather than the maths convention — the y axis on a page points the other way and pretending otherwise makes every later value read backwards.
sweepnumber180Total arc the options are spread across. At a full turn the last option would land on the first, so the spacing switches from end-to-end to evenly-around at 360 — the one place this component has two layout rules.
itemCountnumber6How many options to show. Past about seven the wedges get narrower than the flick they are meant to catch, which is the point at which a list would serve you better.
holdDelaynumber220How long the press has to be held before the fan opens. Releasing sooner is treated as a plain click on whatever is underneath, so the surface stays usable for its normal purpose. At 0 the menu opens on contact and that normal purpose is gone.
staggernumber0.03Delay between one option arriving and the next. Small values read as the fan unrolling; large ones make you wait for the option you already know you want.
stiffnessnumber380How hard the options spring out to their positions.
dampingnumber26How fast that spring settles. Low values overshoot the arc and snap back, which reads as the options being flung rather than placed.
centerCancelnumber28Radius of the dead zone around the press point. Release inside it and nothing commits. At 0 a press that never really moved still resolves to whichever option is nearest the jitter, and the menu picks something you never chose.
accentstring (hex)"#a855f7"Highlight on the option the pointer is aimed at, and on the label echoing it back at the centre.

What It Demonstrates

Hold to confirm
A progress effect that fills up while the user holds a button.
Press / Tap feedback
A subtle scale-down when an element is clicked, so it feels physical.
Stagger
Animate several items one after another with a small delay between each, creating a cascade.
Origin-aware animation
An element animates out of its trigger, like a popover growing from the button that opened it instead of from its own center which is the default in CSS.
Spring
Motion driven by physics (tension, mass, damping) rather than a set duration.
Enter / Exit
The animation an element plays when it's added to or removed from the screen.
Direction-aware transition
Content slides one way going forward and the opposite way going back, so navigation has a sense of direction.

Related Components

Appears In