Noticecomponent

Notice({
	children, //
	icon,
	...props
}: NoticeProps): void
ParamType
childrenNoticeProps
The notice content. required
    .iconReactElement
false
Icon for the notice (or null or false to hide the icon, defaults to <StatusIcon>).
Return
unknown
The notice callout element.

Block-level status callout with an icon and message, used to highlight feedback.

  • Shows a <StatusIcon> for the current status by default; pass icon to override, or false/null to hide it.
  • Sets an ARIA role of "alert" for error/danger statuses, otherwise "status".

A block-level status callout with an icon and message, used to highlight feedback. Rendered as an <aside> with a status icon and a message, mapping its status to the appropriate colour and ARIA role.

Things to know:

  • Shows a <StatusIcon> for the current status by default; pass icon to override, or false / null to hide it.
  • Sets an ARIA role of "alert" for error / danger statuses, otherwise "status".
  • LOADING_NOTICE is a shared <Notice status="loading" /> element ready to drop into Suspense fallbacks.

Usage

tsx
import { Notice } from "shelving/ui";

<Notice status="success">Your changes have been saved.</Notice>
<Notice status="error">Something went wrong.</Notice>
<Notice status="loading" />
tsx
import { LOADING_NOTICE } from "shelving/ui";

<Suspense fallback={LOADING_NOTICE}>
  <SlowPanel />
</Suspense>

Styling

Notice paints from the tint ladder; override these hooks at :root (or any ancestor scope) to retheme. Move --notice-tint to recolour everything at once.

VariableStylesDefault
--notice-tintTint anchor for the notice scopeinherit (flows from color= / status= / parent)
--notice-backgroundSurface fillvar(--tint-90)
--notice-colorText colourvar(--tint-50)
--notice-borderBorder shorthandvar(--notice-stroke) solid var(--tint-80)
--notice-strokeBorder thicknessvar(--stroke-normal) (2px)
--notice-radiusCorner radiusvar(--radius-xsmall)
--notice-paddingInner paddingvar(--space-small)
--notice-spaceOuter block margin (top + bottom)var(--space-paragraph)
--notice-sizeFont sizevar(--size-normal)
--notice-weightFont weightvar(--weight-strong)

Global tokens it reads — the tint ladder --tint-50 / --tint-80 / --tint-90, plus --space-paragraph, --space-small, --radius-xsmall, --stroke-normal, --size-normal, and --weight-strong.

Examples

<Notice status="success">Saved your changes</Notice>