SideNavElement
<vaadin-side-nav> is a Web Component for navigation menus.
<vaadin-side-nav>
<vaadin-side-nav-item>Item 1</vaadin-side-nav-item>
<vaadin-side-nav-item>Item 2</vaadin-side-nav-item>
<vaadin-side-nav-item>Item 3</vaadin-side-nav-item>
<vaadin-side-nav-item>Item 4</vaadin-side-nav-item>
</vaadin-side-nav>Customization
You can configure the component by using slot names.
| Slot name | Description |
|---|---|
label | The label (text) inside the side nav. |
Example
<vaadin-side-nav>
<span slot="label">Main menu</span>
<vaadin-side-nav-item>Item</vaadin-side-nav-item>
</vaadin-side-nav>Styling
The following shadow DOM parts are available for styling:
| Part name | Description |
|---|---|
label | The label element |
children | The element that wraps child items |
toggle-button | The toggle button |
The following state attributes are available for styling:
| Attribute | Description |
|---|---|
collapsed | Set when the element is collapsed. |
focus-ring | Set when the label is focused using the keyboard. |
focused | Set when the label is focused. |
The following custom CSS properties are available for styling:
| Custom CSS property |
|---|
--vaadin-side-nav-child-indent |
--vaadin-side-nav-items-gap |
--vaadin-side-nav-label-color |
--vaadin-side-nav-label-font-size |
--vaadin-side-nav-label-font-weight |
--vaadin-side-nav-label-line-height |
See Styling Components documentation.
Properties
Whether the side nav is collapsible. When enabled, the toggle icon is shown.
A change to this property triggers an update of the highlighted item in the side navigation. While it typically corresponds to the browser's URL, the specific value assigned to the property is irrelevant. The component has its own internal logic for determining which item is highlighted.
Whether to expand parent items of the nested matching item after initial rendering or navigation. By default, all the parent items are expanded. Set to true to disable this behavior.
Callback function for router integration.