Skip to content

Dropdown menu - Web Component โ€‹

Browser support โ€‹

Detected engine: ย 

  • Chromium

  • Webkit

  • Gecko

Parameters โ€‹

The Web component uses the <z-dropdown-menu> tag:

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescription
contentstringText of the dropdown
elementsObject[]Array of dropdown elements

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.

elements โ€‹

The elements attribute is used to set the elements of the dropdown menu.

Example

The elements object also allows nested elements.

Example

The elements object also allows sections and separators.

Example

Finally the elements object also allows icons.

Example

Playground โ€‹

Customization โ€‹

HTML Examples โ€‹

Imports
html
<link rel="stylesheet" href="/0.4.5/@zurich/web-components/styles.css" />
<script type="module" src="/0.4.5/@zurich/web-components/dropdown-menu.js"></script>
Code
html
<z-dropdown-menu
  elements='[{"text":"First Action", "icon":"bookmark:line"}, {"text":"Second Action", "icon":"clock:line"}, {"text":"Third Action", "icon":"gear:line"}, {"text":"Fourth Action", "icon":"user-male:line"}]'>
  Dropdown example
</z-dropdown-menu>