Nav
The Nav component provides a reusable pattern for nav in the interface.
Vertical navigation
Vertical navigation (with border)
Vertical navigation (with border and indented)
Horizontal navigation
Horizontal navigation (with dropdown)
Compressed vertical navigation
Vertical navigation with reduced spacing between items using the compressed parameter.
Horizontal navigation (extended dropdown)
Horizontal navigation with the extended mega-menu dropdown enabled via isExtendedDropdown, presenting child items in a full-width panel.
-
Arbete
-
Bo, bygga och miljö
-
Förskola och utbildning
-
Kommun och politik
-
Omsorg och stöd
Navigation with tile-style items
Horizontal navigation where each item uses the tiles style, rendering links as card-like tiles with an icon and label.
Navigation with button-style items
Navigation mixing button-style items with default links, demonstrating how individual items can be rendered as filled or outlined buttons.
Vertical navigation with active and ancestor state
Vertical navigation with a current-page item (active) and its expanded parent (ancestor), showing how the component highlights the active trail.
API
| Parameter | Default | Description |
|---|---|---|
|
items
|
[] | An nested array of items containing: id, label, active, ancestor, children(bool = async loading, or array), href, style, class, and color (which overrides the color settings). Attribute list may also contain 'data-fetch-url' to enable asyncrounous fetching. |
|
direction
|
vertical | Modifier for basic direction. Accept values: 'vertical', 'horizontal.' |
|
includeToggle
|
false | Tells wheter to include toggle button to expand childs or not. Accept values: true, false. |
|
isExtendedDropdown
|
false | If true, the nav will be presented as an extended dropdown menu. Should only be used for top level horizontal navs. |
|
allowStyle
|
true | Allow the use of style parameter in this menu (item.style = 'button') |
|
buttonStyle
|
filled | If the nav is presenting buttons, what style they should be in. |
|
buttonColor
|
primary | If the nav is presenting buttons, what color they should be in. |
|
expandLabel
|
Expand | Prefix for labels on expand arrow. Will result in Expand: Link label, or if label is missing, just Expand. |
|
height
|
The default height of the menu (only supports horizontal navigation). Values: sm, md, lg. | |
|
compressed
|
false | Makes the spacing between items smaller and the overall navigation more compressed. |
|
expandIcon
|
expand_more | The icon to use for the expand button. Accepts any icon name from the icon library or svg. |
|
indentSubLevels
|
false | If true, sublevels will be indented. |
CSS API
| Variable | Default | Type | Values | Description |
|---|---|---|---|---|
|
--c-nav--base
|
var(--base) | range | - | Main unit that drives radius and spacing scales. |
|
--c-nav--border-radius
|
var(--border-radius) | range | - | Border Radius |
|
--c-nav--color--surface
|
var(--color--surface) | color | - | Surface |
|
--c-nav--color--primary
|
var(--color--primary) | color | - | Primary |
|
--c-nav--shadow-color
|
var(--shadow-color) | rgba | - | Shadow Color |
|
--c-nav--shadow-amount
|
var(--shadow-amount) | range | - | Multiplier for elevation shadows. 0 = none, 1 = default. |
|
--c-nav--color--primary-contrast
|
var(--color--primary-contrast) | color | - | Primary Contrast |
|
--c-nav--color--surface-border
|
var(--color--surface-border) | color | - | Manual companion token for borders on surface elements. |
|
--c-nav--color--surface-contrast
|
var(--color--surface-contrast) | color | - | Used for text and icons on surface backgrounds with less contrast. |