Components

Dropdown Menu

A menu written on a slip of paper that drops from a button. The row under the pointer or the keyboard wears the highlighter, a ticked row is a pencil box with a felt-tip tick over it, shortcuts are drawn keycaps, and a destructive row hatches in red pencil instead. Sub-menus, typeahead and focus handling are Radix's.

Install

terminal
npx shadcn@latest add @wobko/dropdown-menu

First time here? Add the registry to components.json first. How to install

Examples

Account menu

The shadcn demo on a slip: a typewriter label, rows with drawn icons and keycaps, a disabled row, a sub-menu, and a destructive row last.

Ticks and dots

Checkbox rows are a pencil box with a felt tick written over it; radio rows are a ring with a bold dot. Both are controlled here, and the rows keep the menu open so you can tick several.

Other paper

The slip is a Paper, so it can be cut from any stock and held down with tape. A sticky note with a taped corner for quick actions; the destructive row hatches when you reach it.

Row actions (composed)

A real use: a list of notebooks, each row with an ellipsis button that opens its own menu. Choosing Rename or Move to trash changes the list, so you can see the handlers run.

Checkboxes

shadcn's `dropdown-menu-checkboxes`: three controlled rows, the middle one disabled. The state is a boolean (or "indeterminate") that you own; the menu stays open while you tick.

Radio group

shadcn's `dropdown-menu-radio-group`: one value for the whole group, `value` and `onValueChange` as in Radix. The chosen row carries the drawn dot.

Opening dialogs from a menu

shadcn's `dropdown-menu-dialog`: the dialogs live beside the menu, not inside it, and `onSelect` flips their open state. `modal={false}` on the menu keeps the page interactive while it closes, so focus lands in the dialog.

API reference

DropdownMenuContent

The slip: a Paper that is also the Radix content (role=menu). A CSS sheet with no SVG unless a torn edge is asked for. Rows scroll in a viewport inside it, never the slip, so its shadow and tape are not cut. `max-h-*`, `overflow-*` and `overscroll-*` in `className` are applied to that viewport (shadcn code writes them on the content), the rest stays on the slip. Every Radix Content prop passes through (`side`, `align`, `sideOffset`, `collisionPadding`...).

PropTypeDefaultDescription
sideOffsetnumber6Gap between the trigger and the slip (upstream's is 4).
stockStockName"slip"What it is made of: slip, paper, kraft, sticky-*, index-card ...
edgeEdgeSpec"cut"Cut (pure CSS), torn, deckle ...
tiltboolean | numbertrueSmall seeded tilt of the sheet; text stays upright.
tape"corner" | "top" | "both" | falsefalseStrips of masking tape holding the slip down.
seedstring | number-Pins the hand.

DropdownMenuLabel

A heading in the typewriter, like the kicker of a form.

PropTypeDefaultDescription
insetbooleanfalseLines the text up with rows that carry a tick or an icon.

DropdownMenuItem

A row. It is not an ink host: the highlighter is a CSS background, so a plain row costs one element. (A ticked row carries two small icons, about 4 KB of markup: for a list of hundreds to choose from, reach for Command or Combobox.)

PropTypeDefaultDescription
insetbooleanfalseLines the text up with rows that carry a tick or an icon.
variant"default" | "destructive""default"Destructive is red, and its highlight is a red pencil hatch (a pattern, not only a hue).
onSelect(event: Event) => void-Runs when it is chosen; call `event.preventDefault()` to keep the menu open.
disabledbooleanfalsePencil-gray, skipped by the arrow keys, cannot be chosen.

DropdownMenuCheckboxItem

A toggle row: a pencil box at the start, ticked in blue felt (written on) when `checked`.

PropTypeDefaultDescription
checkedboolean | 'indeterminate'-Controlled state.
onCheckedChange(checked: boolean) => void-Called when it is toggled.

DropdownMenuRadioItem

One choice: a pencil ring with a bold felt dot in the chosen one.

PropTypeDefaultDescription
valuestring-The value this row stands for.

DropdownMenuSubTrigger

The row that opens it, with a hand-drawn chevron. It keeps the highlighter while its sub-menu is open.

PropTypeDefaultDescription
insetbooleanfalseLines the text up with rows that carry a tick or an icon.

Accessibility

  • Radix DropdownMenu: the trigger has aria-haspopup=menu, aria-expanded and aria-controls; the content is role=menu labeled by the trigger. Rows are menuitem, menuitemcheckbox (aria-checked) and menuitemradio.
  • Enter, Space and ArrowDown on the trigger open it with the first row highlighted (ArrowUp opens nothing). Up and Down move (pass `loop` to the content to wrap), Home and End jump, typing a letter jumps to the next row that starts with it, ArrowRight opens a sub-menu and ArrowLeft closes it, Enter or Space chooses, Escape closes and returns focus to the trigger. Disabled rows are skipped.
  • The highlight follows the keyboard as well as the pointer (`data-highlighted`) and is the focus indicator: dark text on the highlighter is 12:1, and because the highlighter itself is faint against the slip, a row with keyboard focus also gets a bar of blue felt at its start edge. A destructive row's cue is the word, the red glyph and the hatch.
  • Ticks, dots, chevrons and the pencil boxes are aria-hidden drawings. Keycaps are real `kbd` elements; the command glyph carries the name Command.
  • Rows are 32 px high (28 compact and calm). Nothing depends on hover. Portalled content repeats the InkProvider's data-density, data-motion and data-theme; with reduced motion it appears without the slide and zoom. In forced-colors mode the ticks keep the system text color and the highlighted row takes the system highlight colors.

Source

The files the CLI copies into your project.

Loading the source