Dropdown menu

Actions and options behind a button, on the Select list's surface. Arrow keys move, typing jumps to an item, Escape closes.

Actions

The menu on a row's more button.

5. mars

Starefoss ledning

<DropdownMenu>
	<DropdownMenuTrigger>
		{#snippet child({ props })}
			<Button {...props} variant="ghost" size="sm" square iconLeft="ellipsis-vertical" aria-label="More" />
		{/snippet}
	</DropdownMenuTrigger>
	<DropdownMenuContent align="end">
		<DropdownMenuItem icon="pen" onSelect={edit}>Edit</DropdownMenuItem>
		<DropdownMenuItem icon="copy" shortcut="⌘D" onSelect={duplicate}>Duplicate</DropdownMenuItem>
		<DropdownMenuSeparator />
		<DropdownMenuItem icon="trash" variant="danger" onSelect={remove}>Delete</DropdownMenuItem>
	</DropdownMenuContent>
</DropdownMenu>

Options

Checkbox and radio items set view options. The menu stays open while you set them.

Rules

  • More actions open from the vertical ellipsis, a ghost icon button with the tooltip "More". On a row, align the menu to the end.
  • Items are verbs, like the buttons they replace. Most used first.
  • Delete and other things that can’t be undone go last, after a separator, in danger, and open a confirm dialog.
  • Icons on all items or on none. A shortcut only if it works.
  • Options that filter or sort keep the menu open, so several can be set in one go.
  • One level of submenu at most. Deeper belongs in a dialog.