Callout
StableA message box inside the page, with a color for its mood, an optional title and an optional button.
Also known as alert, banner, notice, inline message
Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.
Informational
Draft saved
<Callout title="Draft saved">Your changes are saved and will sync when you are back online.</Callout>The default mood. Use it for neutral notes that ask nothing of the reader.
When to use it
A notice that sits inside the page instead of popping up over it. The soft color sets the mood, while the icon and the words carry the meaning.
Made of: Icon · Title · Text · Button
Use it for
- A note about the page or the app, such as a saved draft or an unstable connection.
- A warning someone should read before going on.
- A short message with one button that fixes or follows up on it.
Not for
- A failure the person can try again: use ErrorState.
- A request the assistant will not do: use RefusalNotice.
- A usage limit with a reset time: use RateLimitNotice.
Do and avoid
Your trip is saved
Notice
Do
- Give every callout a title or a clear first sentence, so color is not the only clue.
- Add one button for the next step the reader can take, like Retry or Upgrade.
- Use danger only for things that failed. Use info for limits and neutral notes.
- Keep the text to one or two sentences.
Avoid
- Do not stack several callouts. Combine them or show the most important one.
- Do not use warning as decoration. It is amber, which tells people to take a look.
- Do not put long forms or lists inside. Link to a fuller page instead.
- Do not use neutral or accent colors. Only the four moods work here.
On a phone
- Fills the width of its container, and the message wraps beside the icon.
- On a phone the action drops to its own line under the message, so the message keeps its full width.
- The action button keeps its size and has a 44px tap area on touch screens.
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
| tone | "info" | "success" | "warning" | "danger" | "info" | Colour family of the surface and text. Info and success use the info icon, warning and danger use the alert icon. |
| title | string | none | Short bold heading above the body. |
| children | ReactNode | none | Body content. Rendered at 90% opacity under the title. |
| action | ReactNode | none | Trailing slot, usually a small Button. |
"Show code under the preview gives the code for the example on the stage."
In Figma
In Figma, one Callout switches all of this from its properties panel, across 4 variants. Each property sets the React prop beside it, so design and code use the same names.
| Figma property | React | Values |
|---|---|---|
| Tone | tone | Info, Success, Warning, Danger |
| Title | title | Any text |
| Text | children | Any text |
States
States this part has beyond its default look. Build each one your screen can reach. States set by a property are in the Code tab.
- danger
- Set tone to danger to announce it as an alert; the other tones announce it as a status.
Tokens
Change one of these and every part that uses it follows.
--info-soft--info-fg--success-soft--success-fg--warning-soft--warning-fg--danger-soft--danger-fg--radius-card
Built in
- When it appears, screen readers announce danger right away and the other moods politely.
- The icon is hidden from screen readers.
- Info and success show a circle icon, warning and danger a triangle, so color is never the only clue.
What you need to do
- Write a title or text that says what happened, because the icon is not read out.
- Name the button for what it does, such as "Retry upload".
- Use the danger mood only for problems that need attention now, because screen readers interrupt for it.
Built toward WCAG 2.2 AA and checked automatically; no independent audit yet. Read the accessibility guide