Dropdown menu - CSS Component
Browser support
Construction
The CSS component uses a <nav>
tag with the z-dropdown-menu
HTML custom attribute.
z-dropdown-menu
The z-dropdown-menu
parameter is the main parameter used to render the dropdown menu component.
INFO
Check the z-dropdown-menu
anatomy to know the specifications for this component. Use the Playground to see how you can customize this component.
The dropdown component also allows nested elements.
The dropdown items can be separated by a divider. And also, separated by a section heading.
Each item can have an icon.
Playground
Customization
HTML Examples
Imports
html
<link rel="stylesheet" href="/0.3.7/@zurich/css-components/base.css" />
<link rel="stylesheet" href="/0.3.7/@zurich/design-tokens/Icons.css" />
<link rel="stylesheet" href="/0.3.7/@zurich/css-components/DropdownMenu.css" />
Code
html
<nav z-dropdown-menu='default'>
<a href='#'>Dropdown example</a>
<ul>
<li icon="bookmark:outline">First Action</li>
<li icon="clock:outline">Second Action</li>
<li icon="gear:outline">Third Action</li>
<li icon="user-male:outline">Fourth Action</li>
</ul>
</nav>