Skip to content

Dropdown menu

A menu of actions anchored to a trigger. Built on the native Popover API: top layer, light dismiss and Escape are free.

CSS + mian.js JSON Markdown Registry item

Basic

Signed in as [email protected]

Checkable items

Visible columns

Icon trigger, aligned to the end


Installation

Everything ships in one stylesheet and one small script. There is nothing to import per component.

<link rel="stylesheet" href="https://mian.ro/dist/mian.css">
<script src="https://mian.ro/dist/mian.js" defer></script>

Prefer to own the files? /r/dropdown.json is a registry item with this component's CSS and example markup, ready to copy into your project with any tool that reads the open registry-item format.

Class reference

Class / attributeDescription
mn-menu + popoverThe menu panel. Give it an id and point a button's popovertarget at it.
mn-menu-itemA menu item: button or link. Add mn-danger for destructive items.
mn-menu-label · mn-menu-sep · mn-menu-shortcutGroup label, separator, trailing shortcut hint.
data-placementbottom-start (default), bottom-end, top-start, top-end, right-start, left-start…
aria-checkedMakes an item a checkable menuitemcheckbox; the menu stays open when toggled.

Accessibility

  • mian.js adds role="menu" and role="menuitem", wires aria-expanded and aria-haspopup on the trigger.
  • Focus moves to the first item on open. Arrow keys, Home, End and type-ahead navigate. Escape and Tab close.
  • Focus returns to the trigger after choosing an item.
  • The menu emits mn:select with the chosen item.
Choose a noodle

Minimal

Flat

Pixel

Linear

Thin

Glass

Textured

Bold

Elegant

Rounded

On this page