Callout

ui.css · Cross-system: Cross-system reference § Feedback

Overview

.callout is a tinted remark about the thing it sits beside — one field, one form, one panel. It is shape only: a flex row with a tinted background, which the caller tints by setting the --_tint custom property. There are no variant classes, because the tint is what carries the meaning.

A callout is not a page-level status surface. A message about the whole page belongs in <ui-statusbar> or toast(), both driven from the notifications store. A strip prepended above a page's content displaces that content as it appears, and it bypasses the store's rules about which message is current. Put the remark next to what it is about, or route it through the store.

Controls are optional. A callout may carry the buttons that address the thing it describes, and it may carry none at all — an icon and one sentence is a complete callout.

Callout or card?

They look alike and answer different questions, so the choice is worth stating. <article> — Card represents a thing: one document, one job, one member. It has a title, a meta line, optional actions and often a stretched link to the thing itself. A callout represents nothing; it is a remark about something else on the page, and on its own it does not make sense.

The difference that decides it is colour. A card is deliberately neutral, because its content varies and the surface must not editorialise. A callout is tinted, and the tint is part of the message. That is also why a callout is not a card variant: it keeps almost none of the card's declarations, and the two share their tokens rather than their rules.

If you would give it a heading, it is a card. If it only makes sense next to something else, it is a callout.

Anatomy

Any block element with class="callout". Use <aside> when the remark is genuinely tangential to the surrounding content and <div> when it is part of the flow of the panel it sits in.

The primitive styles the box and not its contents. A <p> inside a callout keeps the browser's default margins, so a caller that wraps its text in one sets margin: 0 itself. This is deliberate: a callout with several lines often wants margins of its own, and a blanket reset here would only be overridden.

Usage

The smallest callout is the class and one sentence.

Show code

Tint

The caller sets --_tint to any colour. There is no closed set of names to choose from, which is why Modifiers lists the callout as having no variants. Use the page's semantic aliases rather than raw palette values, and set the property inline for a one-off or in a class when several callouts share a meaning.

Show code

--success, --error and --info come from the application's own token layer; ui.css names them with literal fallbacks so the library still renders in a page that defines none of them.

.bordered and the action cluster

.bordered adds an outline mixed from the same tint and switches the row to justify-content: space-between, which pushes a trailing .callout-actions to the far edge. Use it when the callout carries controls, so the controls have a side of their own; without it they sit immediately after the text.

Show code

The cluster takes as many controls as the case needs. That is the difference from a statusbar item, which supports at most one action: a remark that needs two answers — do the work, or record that it is handled — belongs here rather than there.

Show code

Long text and the icon

align-items: center centres a leading icon against the whole box, which is what a one-line callout wants. When the text wraps to several lines, the icon reads better on the first line: set align-items: start on your own class, and nudge the icon down by about 0.15em so it sits on the text's baseline rather than the top of its line box.

Show code

Accessibility

Cross-system

See Cross-system reference § Feedback. Other systems draw the same box under the name Alert — Bootstrap's .alert and shadcn's Alert are the closest equivalents, and Material Design 2's Banner was the same pattern before Material 3 dropped it. Radix has no inline alert of its own; its Alert Dialog is an interruption, which is <ui-dialog alertdialog> here. The name alert is avoided in this library because it reads as the ARIA role, and a callout is not a live region.

See also