Skip to content
Norn
Menu

norn-side-nav

Sidebar navigation from a list of pages. Marks the current page with aria-current="page", and a page holding it with aria-current="true". An item may carry a norn-icon name and child pages, which list under it, indented. The current page takes a tint of the accent and the accent as its text color, and the pointer takes a lighter layer. In a sticky norn-sidebar-layout column only the list scrolls, so a search field in the search slot stays put.

<norn-side-nav> a landmark, from @allons-y/webc-patterns

Examples

Color scheme
Width

Open on its own

Source
<norn-side-nav :@items="([{&quot;href&quot;:&quot;/frames/patterns/norn-side-nav/default/&quot;,&quot;title&quot;:&quot;Getting started&quot;},{&quot;href&quot;:&quot;#usage&quot;,&quot;title&quot;:&quot;Usage&quot;},{&quot;href&quot;:&quot;#reference&quot;,&quot;title&quot;:&quot;Reference&quot;}])"></norn-side-nav>

Props

Write them with the @ prefix, and :@ for an expression.

NameTypeDescription
@items required { href: string, title: string, icon?: string, children?: { href: string, title: string }[] }[] The pages, in order.

Slots

NameDescription
label The landmark name, read but not shown, as one element. Falls back to the site's componentStrings, then "Pages".
search A search field above the list, as one element.

Tokens

The global tokens from tokens.json the component reads. Set one in a project's tokens.css to change it everywhere.

Type a value to try it in every example above. Reset puts the default back.

Token Type Default Override
--norn-ui-accentThe brand color, shared by every component. <color> #2346d4
--norn-ui-radius-sCorner radius of a part inside a component, and of inline code. A component's own radius is ui.border.radius. <length> 4px
--norn-ui-state-hoverShare of the text color mixed into the background while the pointer is over a control. <percentage> 8%
--norn-ui-state-pressShare of the text color mixed into the background while a control is pressed, and of the accent on a selected or current item. <percentage> 12%
--norn-ui-motion-durationLength of a state change, such as a hover layer. <time> 150ms
--norn-ui-motion-easingEasing for every transition. <easing-function> cubic-bezier(0.2, 0, 0, 1)
--norn-text-mutedSecondary text color. <color> light-dark(#4b5160, #a4abba)
--norn-text-accentThe accent for text and links: darkened in light mode, lightened in dark mode. The lightness caps keep any accent at 4.5:1 or better. <color> light-dark(oklch(from color-mix(in oklch, var(--norn-ui-accent, #2346d4) 82%, black) min(l, 0.5) c h), oklch(from color-mix(in oklch, var(--norn-ui-accent, #2346d4) 55%, white) max(l, 0.72) c h))
--norn-font-size-sSmall text: captions, code, navigation, and notes. <length> 0.875rem
--norn-space-2xsSmallest spacing step. <length> 0.25rem
--norn-space-xsExtra small spacing step. <length> 0.5rem
--norn-space-sSmall spacing step. <length> 0.75rem