A message about the page or the site: information, success, a warning, or an error, with an icon and an optional action. Color is never the only cue: the icon and a word for the severity, read but not shown, come first. The message goes in the default slot, and an action, such as a norn-link-button, in the action slot. A notice already on the page when it loads is static. Set :@live="true" on one the page adds later, so a screen reader announces it: politely, or at once for a warning or an error.
<norn-notice>
a container, from
@allons-y/webc-patterns
<div style="display: grid; gap: 0.75rem">
<norn-notice><p>A new version is out.</p></norn-notice>
<norn-notice @severity="success"><p>Saved. The changes apply on the next build.</p></norn-notice>
<norn-notice @severity="warning"><p>This page describes the beta.</p></norn-notice>
<norn-notice @severity="danger"><p>The build failed.</p></norn-notice>
</div>
Copy {name} to clipboardCopyCopiedCopy failedhtml code
<norn-notice @severity="warning">
<p>This page describes version 1, and version 2 is out.</p>
<norn-link-button slot="action" @href="#v2" @variant="quiet" @tone="current">Read the version 2 docs</norn-link-button>
</norn-notice>
Copy {name} to clipboardCopyCopiedCopy failedhtml code
Copy {name} to clipboardCopyCopiedCopy failedhtml code
Props
Write them with the @ prefix, and :@ for an expression.
Name
Type
Description
@severity
string
How serious the message is. One of info, success, warning, or danger. Falls back to info.
@live
boolean
Announce the notice when it appears.
Slots
Name
Description
prefix
The severity word read before the message, with its punctuation, as one element, such as <span slot="prefix">Remarque : </span>. Falls back to the site's componentStrings for the severity, then "Note: ", "Success: ", "Warning: ", or "Error: ".
default
The message.
action
One action, such as a norn-link-button with @variant="quiet" and @tone="current", so it reads in the text color and doesn't compete with the severity.
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-radiusCorner radius.
<length>
6px
--norn-ui-icon-mIcon size beside a heading or a title.
<length>
1.25rem
--norn-surface-basePage surface. Light and dark values.
<color>
light-dark(#ffffff, #101216)
--norn-space-sSmall spacing step.
<length>
0.75rem
--norn-space-mMedium spacing step.
<length>
1.25rem
--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.