<content-navigation-block>
Site navigation that collapses into a menu button on the breakpoints you choose, with a skip link for keyboard users.
import '@content-blocks/js/components/content-navigation-block';Examples
A site menu
A row of links from 768px, and a menu button that opens them over the page on phones.
Anatomy
Content goes into the component's slots, chosen with the slot attribute on each child.
flowchart LR root["#lt;content-navigation-block#gt;"]:::component root --> s0["<b>no slot (default)</b><br/>The default slot"] root --> s1["<b>slot=#quot;closeButton#quot;</b><br/>This slot will close the navigation when clicked."] root --> s2["<b>slot=#quot;content#quot;</b><br/>Default slot"] root --> s3["<b>slot=#quot;openButton#quot;</b><br/>This slot will expand the navigation when clicked."] root --> s4["<b>slot=#quot;skipContent#quot;</b><br/>This slot is a keyboard-focus link that lets a screen-reader or keybo…"] classDef component fill:#141413,color:#faf9f5,stroke:#141413
| Slot | What goes in it |
|---|---|
(default) | The default slot |
slot="closeButton" | This slot will close the navigation when clicked. |
slot="content" | Default slot |
slot="openButton" | This slot will expand the navigation when clicked. |
slot="skipContent" | This slot is a keyboard-focus link that lets a screen-reader or keyboard user skip the navigation block and scroll to the end. |
Properties
Set them as attributes. Those marked responsive take a value per breakpoint, separated by pipes and named or in order: 1|tablet=2 or 1|2. Seeresponsive values.
| Attribute | Type | Default | Description |
|---|---|---|---|
classesresponsive | String | – | Classes to add to the component. Use pipes for different classes per breakpoint, by name or in order: classes="stacked|laptop=side-by-side". |
close-label | String | 'Close menu' | The accessible name of the default close button. |
hamburgerresponsive | Select | 'fixed|none' | Not documented yet |
open-label | String | 'Open menu' | The accessible name of the default menu button. |
paddingresponsive | String | – | Padding around the component, written as CSS padding. Use pipes for different padding per breakpoint, by name or in order: padding="1rem|tablet=2rem 4rem" or padding="1rem|2rem 4rem|3rem 5rem 4rem". |
flowchart LR v["hamburger=#quot;fixed|none#quot;"]:::value v --> b0["mobile, from 0px: fixed"] v --> b1["tablet and up, from 768px: none"] classDef value fill:#1d4ed8,color:#fff,stroke:#1d4ed8
