A menu display a set of selectable actions or options.
MenuItem in a MenuList by adding ListSubheader.MenuList in a Menu by putting them in MenuBody.MenuList in a horizontal direction by setting the columns prop to true for Menu.sm, md, lg and responsive and can be changed by passing the size prop.size is lg.responsive, the component will be responsive to the viewport.Screen prefix | Screen width | Component size |
|---|---|---|
|
| sm |
|
| md |
|
| lg |
CollapsibleMenuItem component.CollapsibleMenuItem can be controlled open state by open and onOpenChange props.CollapsibleMenuItem required label prop to render the in MenuItem as a trigger of Collapse component.CollapsibleMenuItem component recursively.collapseIcon prop to CollapsibleMenuItem.collapseIcon is ChevronRightOutline.Menu in DropdownMenu component and provide trigger button in DropdownMenuTrigger to toggle the menu.open stateMenu state with open and onOpenChange props:The dropdownConfig props allow you to set the CSS of the dropdown list.
strategy prop allows you to control the positioning strategy of the popover.absolute and fixed.absolute.dropdownConfig.placement prop.top, right, bottom, left.right-start, or bottom-end. These allow you to align the tooltip to the edges of the button, rather than centering it.bottom.Note: The standalone
placementprop is deprecated. UsedropdownConfig.placementinstead. Theplacementprop will be removed in the next major version.
MenuItem in another DropdownMenu as a DropdownMenuTrigger.Right Arrow | Left Arrow on the MenuTrigger.caret prop to true in DropdownMenu.DropdownMenuTrigger allow user to pass any element as the trigger.button as a trigger so the menu can work correctly and ensure accessibility.MenuItem clicked event can be handled by the onItemClick callback prop of Menu or the onClick function of MenuItem.DropdownMenu component, the MenuItem clicked event will trigger a close drop-down menu. You can prevent this behavior by setting the closeOnItemClick prop of DropdownMenu to false.active behaviorMenuItem could be set to active by passing the active prop to MenuItem.MenuBody will be scrollable.Menu, DropdownMenu follows WAI-ARIA recommendations:
DropdownMenuTrigger has role="button", aria-haspopup="true", aria-expanded, aria-controls="dropdown-id" attributesMenu has role="menu" attributeMenuItem has role="menuitem" attributeDropdown Menu Trigger
Key | Description |
|---|---|
| Opens menu and moves focus to first menuitem |
| Opens branched menu and moves focus to first menuitem |
| Closes branched and moves focus to trigger menuitem |
MenuList
Key | Description |
|---|---|
| Moves focus to the next menu item. If focus is on the last menu item, moves focus to the first menu item. |
| Moves focus to the previous menu item. If focus is on the first menu item, moves focus to the last menu item. |
| Moves focus to the first menu item. |
| Moves focus to the last menu item. |
| Trigger MenuItem clicked event. |
| Moves focus to the next menu item with a label that starts with the typed character if such an menu item exists. Otherwise, focus does not move. |
| Closes the drop-down menu. Sets focus to the menu button. |