Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Overlays

Menu <pm-menu>

Menu (role="menu") opened from a button with popovertarget. Arrow keys, Home/End and typeahead.

Full screen


This component has no props to try here.

<script type="module"> import '@prismora/css'; import '@prismora/elements/icon'; import '@prismora/elements/menu'; import { registerIcons } from '@prismora/elements/icon'; import { chevronDown } from '@prismora/icons'; registerIcons([chevronDown]); </script> <button class="pm-button" data-variant="outline" data-tone="neutral" popovertarget="demo-menu" aria-haspopup="menu"> Actions <pm-icon name="chevron-down"></pm-icon> </button> <pm-menu id="demo-menu"> <button role="menuitem">Rename</button> <button role="menuitem">Duplicate</button> <button role="menuitem" popovertarget="demo-menu-move" aria-haspopup="menu">Move to</button> <pm-menu id="demo-menu-move"> <button role="menuitem">Inbox</button> <button role="menuitem">Archive</button> <button role="menuitem">Projects</button> </pm-menu> <hr> <button role="menuitemcheckbox" aria-checked="true">Show details</button> <div role="group" aria-label="Sort by"> <button role="menuitemradio" aria-checked="true">Sort by name</button> <button role="menuitemradio" aria-checked="false">Sort by date</button> </div> <hr> <button role="menuitem" data-tone="danger">Delete</button> </pm-menu>

Overview

Items: <button role="menuitem"> or <a role="menuitem">. role="menuitemcheckbox" toggles and role="menuitemradio" picks one within its role="group" (or the menu); both show a tick from aria-checked. A submenu is a nested <pm-menu id="x"> opened by an item with popovertarget="x": it opens on hover, click and Arrow Right, and closes with Arrow Left or Escape.

Attributes

AttributeTypeDefaultDescription
mobileboolean—Native mobile pattern on phones: opens as a swipeable bottom sheet (inherits from ancestors such as <html mobile>; mobile="false" opts out).

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-selectonPmSelectAn item was chosen. detail.checked is there for checkbox and radio items.

Slots

SlotDescription
(default)Menu items: <button role="menuitem">, <a role="menuitem">, <hr> separators, nested <pm-menu> submenus.

Used in templates

Overview dashboardTraffic analyticsOrdersCustomer 360InboxTeam chatAI assistantNotificationsProject boardTeam and rolesBilling and invoicesUser profileAccount settingsPricing plansProduct pageShopping cartCheckoutLanding pageArticleChangelogHelp centreContactAppointment booking