Skip to content
Norn
Menu

norn-tag

A topic label. With @href it is a link: a hairline edge at control contrast, a state layer and an underline on hover and focus, and a heavier edge and label when it is the current page or an active filter. Without @href it is a static tint with no edge, and not focusable. Inside norn-tag-filter, a tag with @tag becomes a toggle.

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

Examples

Color scheme
Width

Open on its own

Source
<norn-tag @href="#css">CSS</norn-tag>
Color scheme
Width

Open on its own

Source
<norn-tag @color="accent">Featured</norn-tag>
Color scheme
Width

Open on its own

Source
<div style="display: grid; gap: 1.5rem">
	<div style="display: grid; gap: 0.5rem">
		<p><code>color = accent</code></p>
		<div>
			<norn-tag @href="#css" @color="accent">CSS</norn-tag>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>color = info</code></p>
		<div>
			<norn-tag @href="#css" @color="info">CSS</norn-tag>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>color = success</code></p>
		<div>
			<norn-tag @href="#css" @color="success">CSS</norn-tag>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>color = warning</code></p>
		<div>
			<norn-tag @href="#css" @color="warning">CSS</norn-tag>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>color = danger</code></p>
		<div>
			<norn-tag @href="#css" @color="danger">CSS</norn-tag>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>current = true</code></p>
		<div>
			<norn-tag @href="#css" @current>CSS</norn-tag>
		</div>
	</div>
	<div style="display: grid; gap: 0.5rem">
		<p><code>current = false</code></p>
		<div>
			<norn-tag @href="#css">CSS</norn-tag>
		</div>
	</div>
</div>

Props

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

NameTypeDescription
@href string Where the tag links, such as the tag's page. With it the tag is a link with the edge of a control; without it, a static label.
@color string A tint from a shared color token: accent, or a status color. Without it the tint is the text color. The label stays in the text color, so the word carries the meaning. One of accent, info, success, warning, or danger.
@current boolean Mark the tag of the page the visitor is on, with aria-current="true". Only on a tag with href.
@tag string The key norn-tag-filter matches against each item's data-tags, such as css. Only on a tag with href.

Slots

NameDescription
default The label, in sentence case.

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-border-strongEdge of a control, such as a field. At least 3:1 on the page surface, which WCAG 1.4.11 asks of a control's boundary. <color> light-dark(#7a8194, #6f7789)
--norn-ui-border-radiusCorner radius. <length> 6px
--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-text-baseText color. <color> light-dark(#16181d, #eceef3)
--norn-font-size-sSmall text: captions, code, navigation, and notes. <length> 0.875rem
--norn-space-2xsSmallest spacing step. <length> 0.25rem
--norn-space-xsExtra small spacing step. <length> 0.5rem
--norn-status-infoInformation. The color of a note or an information notice. <color> light-dark(#1b4fc4, #8fb0ff)
--norn-status-successSuccess. The color of a tip, a success notice, and a copied mark. <color> light-dark(#0b6b3a, #7ed6a1)
--norn-status-warningWarning. <color> light-dark(#9a4a00, #ffb36b)
--norn-status-dangerDanger. The color of a caution and an error. <color> light-dark(#b42318, #ff8a80)