Notice
Notice tells people about a condition that is true right now, placed above the part of the page it affects.
<Notice tone="warning" action={<Button>Renew</Button>}> Your certificate expires in six days.</Notice><Confirmation confirmLabel="Run" cancelLabel="Not now" onConfirm={run} onCancel={dismiss}> Run 4 nodes for $0.32?</Confirmation>Use a Notice to tell people about a condition that is true right now, such as an expiring certificate or a failed sync. Put it in the layout, directly above the region it is about. It takes up space and never floats, so it doesn't cover the content it describes.
A Notice stays for as long as the condition is true and never closes on a timer. It isn't a confirmation of something the person just did, because they didn't cause the condition. Give it at most one action, which fixes the condition, and pass onDismiss to show a ✕ that lets people acknowledge it.
The Notice keeps no state of its own. When someone presses the ✕, your onDismiss callback runs and your app removes the Notice. Store that choice wherever it needs to last, such as in user settings, so the Notice stays dismissed after a reload.
A Notice is neutral by default. Set tone for the kind of condition, such as warning or destructive, and the fill, the text and a Button in the action slot all change colour with it. size sets the padding, the corner, the text and the ✕, but a Button in action keeps its own size, so set it to match.
To ask a question instead, use Confirmation. It has the same look, with two answer buttons in words: a quiet no and a loud yes. It has no ✕, because closing a question doesn't answer it. Set busy while the work starts, and the yes button shows a spinner.
A Notice has role="status", so screen readers read its words when it appears without moving focus. The icon is hidden from screen readers, so the words must carry the meaning. Set dismissLabel to name the ✕ in your app's language. Use a Card when the message needs a heading and several paragraphs, and a Dialog when the person must answer before they continue.
Topics
Every symbol this component exports, grouped by the job it does. Each one carries the props it declares; each one has an anchor of its own.
A condition
Notice
Notice tells people about a condition that is true right now, placed above the part of the page it affects.
| Prop | Type | What it does |
|---|---|---|
action? | React.ReactNode | One action that fixes the condition, such as "Get more usage". |
backdrop? | boolean | Set backdrop when content passes behind the notice, such as a scrolling region. |
children | React.ReactNode | The message, usually one sentence. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
dismissLabel? | string | The accessible name of the dismiss button. |
icon? | React.ReactNode | An icon shown before the message. |
onDismiss? | () => void | Called when the person presses the ✕ dismiss button. |
size? | "1" | "2" | "3" | "4" | Sets the size of the notice: the padding, the corner, the text and the dismiss button. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | Sets the colour family, which tells the category of the message. |
A question
Confirmation
A question that waits for a yes or a no. It looks like a Notice, with two worded answer buttons and no ✕
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Set backdrop when content passes behind the confirmation. |
busy? | boolean | Shows that the work is starting. |
cancelLabel | string | The no, in your words: "Not now". |
children | React.ReactNode | The request, in your words: "Run 4 nodes for $0.32?" |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
confirmLabel | string | The yes, in your words: "Run". |
icon? | React.ReactNode | An icon from your own icon set, shown before the request. |
onCancel | () => void | Called when the person presses the cancel button. |
onConfirm | () => void | Called when the person presses the confirm button. |
size? | "1" | "2" | "3" | "4" | Sets the size of the padding, the corner, the buttons and the text. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | Sets the colour family of the request. |
- A position, and a Banner component — Where a message sits depends on the layout around it, so the parent places the Notice. Put it in the layout above the region it describes. For a notice about the whole app, use
ShellNotice, which theShellplaces above its header. - A toast, or any Notice that disappears on its own — If an action deserves someone's attention, it deserves it before the action runs, not in a message that vanishes afterwards. Show confirmations on the button that did the work instead.
- A title and description — A Notice is a short message, usually one sentence, so it has no fixed title or description parts. When a message needs a heading and paragraphs, use a
Card. - More than one action — The
actionslot holds the one action that fixes the condition. Two competing actions would turn the Notice into a small form, which belongs in the page instead. - Remembering its own dismissal —
onDismissis only a callback, and the Notice keeps no state. Your app stores the dismissal, which is the only way it can survive a reload. - A shadow — A Notice is a strip that sits inside a card or across a page, not a separate layer above it, so it never casts a shadow.
- Built-in icons — The package ships no icons. Pass a glyph from your own icon set to
icon, and it is hidden from screen readers. - A ✕ on a Confirmation — A question needs an answer, and closing it doesn't give one. Word the no answer as a button, just like the yes.