An inline message that sits in the flow of the page, next to the content it's about.
import { Callout } from '@oztix/roadie-components/callout'
Pass the message as children. With no intent, the callout takes the palette of whatever it sits in.
<Callout>Bring photo ID. Every ticket is checked at the door.</Callout>
Leave out either one. A title on its own suits a short status; a description on its own suits a sentence.
<div className='grid gap-3'> <Callout intent='success' title='Your event is live' /> <Callout intent='info'>Doors open at 7pm.</Callout> </div>
subtle is the default. Use normal to sit on a tinted surface, strong for the one message a page can't miss, and subtler for a quiet aside. In a strong callout, give buttons emphasis='normal', because a strong button takes the same fill as the callout.
info, success, warning and danger each bring a status icon. Other intents colour the callout without one.
Build the callout from parts when it needs actions or a rich body. Callout.Icon with no children shows the intent's icon.
Actions sit below the text in a narrow callout and move beside it once there's 32rem of room inside the callout. The callout measures itself, so it lays out the same in a sidebar as on a phone.
onDismiss adds a dismiss button. You own the visibility, so stop rendering the callout in the handler, and remember the choice if it should stay gone.
Pass icon to the short form, or children to Callout.Icon. Pass icon={null} for no icon.
Do
Use a callout for something that stays true while the page is open, next to the content it's about.
Don’t
Don't use a callout to confirm an action that just happened. Use a Toast, which comes and goes on its own.
Do
Lead with what happened and follow with what to do. Keep it to a sentence or two.
Don’t
Don't write a vague title. It tells people something is wrong without telling them what.
Do
Use one strong callout at most on a page, for the message nobody can miss.
Don’t
Don't stack several callouts. When everything stands out, nothing does. Fold related messages into one.
role='status' to announce it politely, or role='alert' to interrupt, only for errors that block the task. Some screen readers only announce changes inside a live region that was already on the page, so for a message that must be heard, keep an empty role='status' wrapper mounted and render the callout into it.render, e.g. <Callout.Title render={<h3 />}>.dismissLabel. When the callout goes, move focus somewhere sensible so it isn't lost.Palette, and the default icon for `info`, `success`, `warning` and `danger`. Omit to inherit from an ancestor.
Defaults to 'subtle'.
Short form: renders the title, the intent's icon and the children as the description.
Short form only: replaces the intent's icon. Pass `null` for none.
Shows a dismiss button. You own the visibility: stop rendering the callout here.
Defaults to 'Dismiss'.
Buttons or links. They sit below the text in a narrow callout and beside it in a wide one.
No additional props. It forwards all standard HTML attributes to the underlying element.
The body. A `div`, so it can hold paragraphs, links and lists.
No additional props. It forwards all standard HTML attributes to the underlying element.
The intent's status icon. Pass children to use your own.
No additional props. It forwards all standard HTML attributes to the underlying element.
Make the title a heading at the level the page needs, e.g. `render={<h3 />}`. Defaults to `<p>`.