Displays a menu to the user — such as a set of actions or functions — triggered by a button.
❯ menuUse the following to build the Menu component.
from components.ui.menu import menuFor manual installation, copy each of the source codes below in their respective locations.
A clean dropdown menu with organizational group labels and visual dividers.
Props used: None.
Dropdown items with right-aligned keyboard command hints built into the row layout.
Props used: menu.shortcut as a child wrapper element.
Row entries decorated with left-side action icons for clean visual scanning.
Props used: hi <hugeicon> as an inline child prefix element.
Incorporate warning styles into individual items for irreversible actions.
Props used: variant="destructive" on menu.item.
Instantiates a positioning context container built around a native HTML <details> disclosure component. Includes automated JavaScript listeners for document keydowns (Escape) and window click-away dismissals.
menu.root(
menu.trigger(...),
menu.content(...)
)
Nested Interactivity Constraint: Do not pass fully interactive components (like standard
button(...)blocks) as children insidemenu.trigger. Nesting interactive elements intercepts DOM click events and prevents the menu from opening. To style your trigger like a button, pass raw strings/icons and apply button classes directly to the trigger component.
The target control wrapper that toggles the open visibility state of the menu list container. Generates a native HTML <summary> element.
menu.trigger(button("Open"))
Layout Boundaries: This component utilizes pure CSS absolute positioning instead of DOM portaling. The popup menu remains nested deep inside its localized DOM tree node. Ensure that no parent container layouts above this component enforce overflow: hidden or overflow: auto constraints, as this will physically clip or crop the floating dropdown menu box.
The relative positioning wrapper box holding the collection of links or action rows.
menu.content(..., side="bottom", align="start")
An action selection row component. Injects a DOM traversal action snippet that walks up to collapse the parent menu immediately upon clicking.
menu.item("Profile Item", variant="default", close_on_click=True)