Skip to content
Norn
Menu

norn-card-grid

Responsive grid of cards. Pass each card in an <li>, as in <li><norn-card>…</norn-card></li>. The list has role="list", which Safari needs once the markers are gone. Each card spans three rows of the grid, with grid-template-rows: subgrid, so the headings, the bodies, and the footers of cards in a row line up. A browser without subgrid shows each card as its own box. Settings for a card, such as its title face or its top line, go on the card as props: <norn-card @title-face="mono">.

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

Examples

Color scheme
Width

Open on its own

Source
<norn-card-grid>
	<li><norn-card><h3>Plain card</h3><p>A short line of body text.</p></norn-card></li>
	<li><norn-card><h3><a href="https://example.com/">Linked card</a></h3><p>A short line of body text.</p></norn-card></li>
	<li><norn-card><h3>Third card</h3><p>A short line of body text.</p></norn-card></li>
	<li><norn-card><h3>Fourth card</h3><p>A short line of body text.</p></norn-card></li>
	<li><norn-card><h3>Fifth card</h3><p>A short line of body text.</p></norn-card></li>
</norn-card-grid>
Color scheme
Width

Open on its own

Source
<norn-card-grid>
	<li><norn-card @title-face="mono"><h3><a href="https://example.com/core">@example/core</a></h3><p>The core package.</p></norn-card></li>
	<li><norn-card @title-face="mono"><h3><a href="https://example.com/cli">@example/cli</a></h3><p>The command line.</p></norn-card></li>
</norn-card-grid>
Color scheme
Width

Open on its own

Source
<norn-card-grid>
	<li>
		<norn-card>
			<h3>Short</h3>
			<p>A short body.</p>
			<p><a href="https://example.com/">Read more</a></p>
		</norn-card>
	</li>
	<li>
		<norn-card>
			<h3>Configure the build for a project with several workspaces and a shared theme</h3>
			<p>Each workspace keeps its own pages and data. The shared theme sets the colors, the type, and the spacing once, and every workspace follows it.</p>
			<p><a href="https://example.com/">Read more</a></p>
		</norn-card>
	</li>
	<li>
		<norn-card>
			<h3>No footer</h3>
			<p>A short line of body text.</p>
		</norn-card>
	</li>
</norn-card-grid>
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-card-grid @gap="s">
				<li><norn-card><h3>Plain card</h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3><a href="https://example.com/">Linked card</a></h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3>Third card</h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3>Fourth card</h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3>Fifth card</h3><p>A short line of body text.</p></norn-card></li>
			</norn-card-grid>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>gap = m</code></p>
		<div>
			<norn-card-grid @gap="m">
				<li><norn-card><h3>Plain card</h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3><a href="https://example.com/">Linked card</a></h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3>Third card</h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3>Fourth card</h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3>Fifth card</h3><p>A short line of body text.</p></norn-card></li>
			</norn-card-grid>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>gap = l</code></p>
		<div>
			<norn-card-grid @gap="l">
				<li><norn-card><h3>Plain card</h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3><a href="https://example.com/">Linked card</a></h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3>Third card</h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3>Fourth card</h3><p>A short line of body text.</p></norn-card></li>
				<li><norn-card><h3>Fifth card</h3><p>A short line of body text.</p></norn-card></li>
			</norn-card-grid>
		</div>
	</div>
</div>

Props

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

NameTypeDescription
@min string Narrowest card, as a CSS length, such as 12rem. Falls back to 17rem.
@gap string Space between cards: s, m, or l, for --norn-space-s, -m, or -l. Falls back to m.

Slots

NameDescription
default The cards, each in an <li>.

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-space-sSmall spacing step. <length> 0.75rem
--norn-space-mMedium spacing step. <length> 1.25rem
--norn-space-lLarge spacing step. <length> 2rem