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
Copy {name} to clipboardCopyCopiedCopy failedhtml code
Props
Write them with the @ prefix, and :@ for an expression.
Name
Type
Description
@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
Name
Description
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.