Menus and pickers
When: polish. While first building a page, use a solid menu/combobox primitive (Radix, Base UI, Floating UI, or the repo's existing component) and move on; these details are applied in a polish pass, on new or existing UI.
Two pickers can look identical and feel completely different. The difference is a handful of behaviors, each small. Related: design-tooltips, design-purposeful-motion.
Opening
- Animate out of the trigger. Set
transform-originto the corner nearest the trigger and scale/translate from there. A menu opening down-right grows down-right; one flipped up-left (near the screen edge) grows up-left. Recompute origin after collision flipping. A menu that grows from its own center, or from the wrong corner, feels detached. - Keep it short (~120–180ms ease-out in, faster or none out). Menus are used constantly.
Submenus: the safe triangle
People move diagonally from the parent item toward the lower items of a submenu, crossing sibling items on the way. Without help, the submenu closes mid-move.
- While the pointer is inside the triangle between its last position and the near edge of the open submenu, don't switch the active item. Optionally add a short (~100–300ms) grace delay before switching.
- Radix/Base UI/Floating UI (
safePolygon) implement this; use them rather than hand-rolling. Test it by moving diagonally to the bottom item.
Multi-select pickers (labels, tags, assignees)
- Focus the filter input on open. Typing filters immediately; ↑/↓ moves, Enter toggles, Escape closes. No mouse needed.
- On open, group selected items at the top, then the rest.
- Never reorder while open. When the user toggles an item, it stays exactly where it is. Moving it to the top would make them hunt for it to undo a misclick. Regroup only the next time the menu opens. Same in reverse when deselecting.
- Keep the highlighted row stable as the list filters; reset highlight to the first match on new input.
- Offer "create" for a new value inline at the bottom when the filter has no exact match.
Everywhere
- Show the keyboard shortcut right-aligned on each menu item that has one.
- Resizable panels show a hint on hover (cursor + subtle handle), and clicking the edge toggles collapse.
- Open on pointer-down for menus people use rapidly; preload menu content when the pointer approaches the trigger.
Checklist
- transform-origin matches the actual opening direction, including flipped placements
- Diagonal move to the last submenu item works
- Picker opens with focus in the filter; full keyboard flow
- Selected grouped on open; toggled items don't move while open
- Shortcuts visible in menu items