Skip to content
Norn
Menu

norn-header

Site header: the brand link, then the primary navigation. Pass the brand as one element in the brand slot, such as <a slot="brand" rel="home" href="/">Name</a>, holding text or an <img> logo with alt text. A logo is 2rem tall, or the height logo-height gives. The default slot holds the navigation links, each an <a> that may start with a norn-icon. Without links there is no navigation landmark. The links are quiet until the pointer or focus is on one, and the one marked aria-current has the text color and a 2px accent line. When the header is narrower than 40rem, the links fold into a closed <details> at the end of the brand's row, under the summary text, and the open menu lists them full width. A browser without ::details-content always shows the control.

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

Examples

Color scheme
Width

Open on its own

Source
<norn-header>
	<a slot="brand" rel="home" href="#">Example project</a>
	<a href="#install">Install</a>
	<a href="#docs"><norn-icon @name="book"></norn-icon>Docs</a>
	<a href="https://example.com/">GitHub</a>
</norn-header>
Color scheme
Width

Open on its own

Source
<norn-header>
	<a slot="brand" rel="home" href="#">Example project</a>
</norn-header>

Props

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

NameTypeDescription
@logo-height string The logo's height, as a CSS length. Falls back to 2rem.

Slots

NameDescription
brand The brand link, as one element.
label The navigation landmark name, read but not shown, as one element. Falls back to the site's componentStrings, then "Primary".
summary The text of the control that opens the links on a narrow header, as one element. Falls back to the site's componentStrings, then "Menu".
default The navigation links.

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-focus-offsetGap between an element and its focus ring. An element the ring would clip draws it inset, at the negative of this. <length> 2px
--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-ui-control-heightHeight of a button, field, or tab. A component raises it to 2.75rem for a coarse pointer. <length> 2.25rem
--norn-surface-raisedRaised surface. <color> light-dark(hsl(40, 14%, 96%), #242932)
--norn-text-baseText color. <color> light-dark(#16181d, #eceef3)
--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-headingHeading face. Follows the body face until the project sets one. <font-family> var(--norn-font-body, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif)
--norn-font-size-mBody text. <length> 1rem
--norn-font-size-lLede, card title, and third-level heading. <length> 1.25rem
--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
--norn-space-mMedium spacing step. <length> 1.25rem