Submenu
Rendering nested Menu components to create a dropdown menu with submenus that open when hovering over the parent menu item.
Undo
Redo
Find
Search the Web...
Find...
Find Next
Find Previous
Speech
Start Speaking
Stop Speaking
12345678910111213141516171819202122
import "./style.css";export default function Example() {return ();}import "./style.css";export default function Example() {return ();}
Components
Anatomy of nested menus
In this example, we created a higher-level abstraction of the Menu component that automatically renders a MenuButton
as a MenuItem
if there's a parent
menu store. This way, you can easily copy and paste it into your project.
However, in practice, creating submenus with Ariakit is as straightforward as nesting Menu
components and merging MenuButton
and MenuItem
into a single element using the render
prop:
Related examples
Submenu with ComboboxNesting Notion-style dropdown menus with search & autocomplete features by combining Menu with Combobox.
Menu with TooltipRendering Menu with a Tooltip that appears when hovering over the MenuButton component by combining it with the TooltipAnchor component.
MenuItemCheckboxRendering a dropdown Menu using the MenuItemCheckbox component with the values and setValues props from MenuProvider to control the checked items.
Menu with Framer MotionAbstracting Menu into a reusable dropdown menu component that uses Framer Motion to create smooth initial and exit animations.
Navigation MenubarUsing Menubar, Menu, and Portal to create an accessible, tabbable navigation menu widget with links and menu buttons that expand on hover and focus.