Skip to content
Norn
Menu

norn-hero

Page intro, in the default slot: an h1, a lede, the actions, the facts, and anything after, such as an install norn-code-block. Write the h1 as one or two <span>s: the name, then a tagline in the accent color. The actions are a <nav aria-labelledby="…">, pointing at a hidden name, holding a <ul role="list"> of norn-link-buttons, and the facts a norn-fact-list with @gap="l".

<norn-hero> a container, from @allons-y/webc-patterns

Examples

Color scheme
Width

Open on its own

Source
<norn-hero>
	<h1><span>Example project</span> <span>A short line about what it does</span></h1>
	<p>Greet anyone by name, from code or from the command line, with no setup.</p>
	<nav aria-label="Get started">
		<ul role="list">
			<li><norn-link-button @href="#install">Get started</norn-link-button></li>
			<li><norn-link-button @href="https://example.com/" @variant="secondary">View on GitHub</norn-link-button></li>
		</ul>
	</nav>
	<norn-fact-list @gap="l">
		<li><norn-icon @name="check"></norn-icon>Free &amp; open source</li>
		<li><norn-icon @name="check"></norn-icon>License: MPL-2.0</li>
		<li><norn-icon @name="check"></norn-icon>Node 24+</li>
	</norn-fact-list>
	<norn-code-block @language="sh" @code="$ npm install @example/project"></norn-code-block>
</norn-hero>
Color scheme
Width

Open on its own

Source
<norn-hero>
	<h1><span>Example project</span></h1>
</norn-hero>
Color scheme
Width

Open on its own

Source
<div style="display: grid; gap: 1.5rem">
	<div style="display: grid; gap: 0.5rem">
		<p><code>width = layout</code></p>
		<div>
			<norn-hero @width="layout"><p>Greet anyone by name, from code or from the command line, with no setup.</p></norn-hero>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>width = measure</code></p>
		<div>
			<norn-hero @width="measure"><p>Greet anyone by name, from code or from the command line, with no setup.</p></norn-hero>
		</div>
	</div>
</div>

Props

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

NameTypeDescription
@width string Content width: layout, --norn-layout-width, or measure, the prose line length, --norn-text-measure. Falls back to layout.

Slots

NameDescription
default The h1, lede, actions, facts, and extras, in that order.

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-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-text-measureLine length for prose. <length> 40em
--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-lLede, card title, and third-level heading. <length> 1.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
--norn-space-lLarge spacing step. <length> 2rem
--norn-space-xlExtra large spacing step. <length> 4rem
--norn-layout-widthWidth of page content. <length> 64rem