Skip to content
Norn
Menu

norn-sidebar-layout

A navigation column beside the page body. Layout only: it sets no heading style and no line length. A page that uses it directly styles its own h1 and the body's line length, as norn-docs and norn-workspace do. Wrap prose in norn-rich-text. Pass the navigation as one element in the nav slot, such as <norn-side-nav slot="nav" …>, and the body, starting with its h1, in the default slot. The navigation stays in view while the page scrolls, and a long list scrolls inside it. When the frame is narrower than 37.5rem the columns stack, and the navigation folds into a closed <details> above the body, under the summary text. A browser without ::details-content always shows the fold. Sections and articles inside the body stack with a small gap. The frame is as wide as --norn-layout-width allows. A project sets another width with CSS against the tag, in its own unlayered stylesheet.

<norn-sidebar-layout> a layout, from @allons-y/webc-patterns

Examples

Color scheme
Width

Open on its own

Source
<norn-sidebar-layout>
	<norn-side-nav
		slot="nav"
		:@items="[
			{ href: '/frames/patterns/norn-sidebar-layout/default/', title: 'Getting started', icon: 'book' },
			{ href: '#usage', title: 'Usage' },
			{ href: '#reference', title: 'Reference' }
		]"
	>
		<span slot="label">Documentation</span>
	</norn-side-nav>
	<h1>Getting started</h1>
	<norn-rich-text>
		<p>Install the project, then run it once to see it work.</p>
		<h2>Install</h2>
		<p>Run the install command in the project folder.</p>
	</norn-rich-text>
</norn-sidebar-layout>
Color scheme
Width

Open on its own

Source
<norn-sidebar-layout>
	<nav slot="nav" aria-label="Sections">
		<p><strong>On this page</strong></p>
		<ul>
			<li><a href="#one">One</a></li>
			<li><a href="#two">Two</a></li>
		</ul>
	</nav>
	<h1>Custom navigation</h1>
	<norn-rich-text>
		<p>A short line of body text.</p>
	</norn-rich-text>
</norn-sidebar-layout>
Color scheme
Width

Open on its own

Source
<norn-sidebar-layout>
	<norn-side-nav
		slot="nav"
		@label="Documentation"
		:@items="[
			{ href: '/frames/patterns/norn-sidebar-layout/sections/', title: 'Overview' },
			{ href: '#details', title: 'Details' }
		]"
	></norn-side-nav>
	<h1>Overview</h1>
	<section>
		<h2>First section</h2>
		<p>A short line of body text.</p>
	</section>
	<article>
		<h2>An article</h2>
		<p>A short line of body text.</p>
	</article>
</norn-sidebar-layout>
Color scheme
Width

Open on its own

Source
<div style="display: grid; gap: 1.5rem">
	<div style="display: grid; gap: 0.5rem">
		<p><code>gap = s</code></p>
		<div>
			<norn-sidebar-layout @gap="s"></norn-sidebar-layout>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>gap = m</code></p>
		<div>
			<norn-sidebar-layout @gap="m"></norn-sidebar-layout>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>gap = l</code></p>
		<div>
			<norn-sidebar-layout @gap="l"></norn-sidebar-layout>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>gap = xl</code></p>
		<div>
			<norn-sidebar-layout @gap="xl"></norn-sidebar-layout>
		</div>
	</div>
</div>

Props

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

NameTypeDescription
@nav-width string The navigation column's width, as a CSS length. Falls back to 14rem.
@gap string The space between the navigation and the body, a step of --norn-space-*. One of s, m, l, or xl. Falls back to l.
@columns string The body's grid columns, as a grid-template-columns value, to put something beside the prose. Falls back to one column.

Slots

NameDescription
nav The navigation, as one element.
summary The text of the control that opens the navigation on a narrow frame, as one element. Falls back to the site's componentStrings, then "Menu". A layout passes the navigation's own name.
default The page body, starting with its h1.

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-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-space-xsExtra small spacing step. <length> 0.5rem
--norn-space-sSmall spacing step. <length> 0.75rem
--norn-space-mMedium spacing step. <length> 1.25rem
--norn-space-lLarge spacing step. <length> 2rem
--norn-space-xlExtra large spacing step. <length> 4rem
--norn-layout-widthWidth of page content. <length> 64rem