Skip to content
Norn
Menu

norn-icon

Inline SVG icon from a small built-in set or the project's own, drawn in currentColor at 1em. Project icons come from the Norn plugin's icons option, which registers them through the nornIcons helper. A project icon with a built-in's name replaces it. Without the plugin, only the built-in set is available. A project icon keeps its own viewBox (else one from a numeric width and height, else 0 0 24 24) and paint, so draw it with currentColor to follow the text color. A file with no paint at all is filled with currentColor. Decorative by default: the drawing is always hidden from assistive tech. When the icon carries meaning on its own, put its name in the label slot, as <span slot="label">Warning</span>: it renders as visually hidden text beside the drawing, so it is read as text, in a link or button name too. WebC can't tell whether a slot has content, so the drawing stays aria-hidden either way and an empty slot adds nothing to read. Directional icons (arrow-start, arrow-end, chevron-end, and a project icon set to mirror) mirror in a right-to-left context.

<norn-icon> a component, from @allons-y/webc-patterns

Examples

Color scheme
Width

Open on its own

Source
<ul role="list" style="display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.75rem; padding: 0; list-style: none">
	<li webc:for="name of $data.csf.argTypes.props.name.options" :data-name="name">
		<norn-icon :@name="name"></norn-icon> <code @text="name"></code>
	</li>
</ul>
Color scheme
Width

Open on its own

Source
<p><norn-icon @name="warning"><span slot="label">Warning</span></norn-icon> This version is no longer supported.</p>
Color scheme
Width

Open on its own

Source
<div style="display: grid; gap: 1.5rem">
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = accessibility</code></p>
		<div>
			<norn-icon @name="accessibility"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = arrow-end</code></p>
		<div>
			<norn-icon @name="arrow-end"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = arrow-start</code></p>
		<div>
			<norn-icon @name="arrow-start"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = book</code></p>
		<div>
			<norn-icon @name="book"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = caution</code></p>
		<div>
			<norn-icon @name="caution"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = check</code></p>
		<div>
			<norn-icon @name="check"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = chevron-down</code></p>
		<div>
			<norn-icon @name="chevron-down"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = chevron-end</code></p>
		<div>
			<norn-icon @name="chevron-end"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = copy</code></p>
		<div>
			<norn-icon @name="copy"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = desktop</code></p>
		<div>
			<norn-icon @name="desktop"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = error</code></p>
		<div>
			<norn-icon @name="error"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = external</code></p>
		<div>
			<norn-icon @name="external"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = fill</code></p>
		<div>
			<norn-icon @name="fill"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = hash</code></p>
		<div>
			<norn-icon @name="hash"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = important</code></p>
		<div>
			<norn-icon @name="important"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = info</code></p>
		<div>
			<norn-icon @name="info"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = link</code></p>
		<div>
			<norn-icon @name="link"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = loading</code></p>
		<div>
			<norn-icon @name="loading"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = moon</code></p>
		<div>
			<norn-icon @name="moon"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = phone</code></p>
		<div>
			<norn-icon @name="phone"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = search</code></p>
		<div>
			<norn-icon @name="search"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = success</code></p>
		<div>
			<norn-icon @name="success"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = sun</code></p>
		<div>
			<norn-icon @name="sun"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = system</code></p>
		<div>
			<norn-icon @name="system"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = tablet</code></p>
		<div>
			<norn-icon @name="tablet"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = tip</code></p>
		<div>
			<norn-icon @name="tip"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>name = warning</code></p>
		<div>
			<norn-icon @name="warning"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>size = s</code></p>
		<div>
			<norn-icon @name="check" @size="s"></norn-icon>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>size = m</code></p>
		<div>
			<norn-icon @name="check" @size="m"></norn-icon>
		</div>
	</div>
</div>

Props

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

NameTypeDescription
@name required string A project icon, or a built-in icon. One of accessibility, arrow-end, arrow-start, book, caution, check, chevron-down, chevron-end, copy, desktop, error, external, fill, hash, important, info, link, loading, moon, phone, search, success, sun, system, tablet, tip, or warning.
@size string s, the default, is --norn-ui-icon-s, which is 1em and follows the text. m is --norn-ui-icon-m, for an icon beside a heading or a title. Another value fails the build.

Slots

NameDescription
label The icon's name, as one element, read but not shown. Leave it out for a decorative icon.

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-icon-sIcon size beside text. It follows the font size. <length> 1em
--norn-ui-icon-mIcon size beside a heading or a title. <length> 1.25rem