Skip to content

Callout

Dismissible alert box with tone-driven coloring, frame variants (inline / rail / bar), and a compound API.

Preview

Installation

$pnpm exec dgadd add ui/callout
[Installs to]src/components/ui/callout[Item]ui/callout

dgadd is not public on npm yet. Until the first release, pack @diffgazer/add from the repository and install that tarball into this app, which is what puts dgadd on pnpm exec.

UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS once packages are available.

Usage

tsx
import { Callout } from "@/components/ui/callout";export default function CalloutDefault() {  return (    <Callout tone="info">      <Callout.Icon />      <Callout.Title>Information</Callout.Title>      <Callout.Content>        This is an informational callout with a title, body text, and a dismiss button — the full        anatomy in one instance.      </Callout.Content>      <Callout.Dismiss />    </Callout>  );}

Examples

Tones

Preview

Frames

Preview

Controlled visibility

Preview

Custom icon

Preview

API Reference

Callout

NameTypeDefaultDescription
tone"info" | "warning" | "error" | "success""info"Semantic tone — drives color and default icon.
frame"inline" | "rail" | "bar""inline"Visual frame: inline border, inline-start rail, or marker bar.
openbooleanControlled visibility state. Pair with onOpenChange.
defaultOpenbooleantrueInitial visibility state for uncontrolled usage.
onOpenChange(open: boolean) => voidCalled when Callout.Dismiss closes the callout or controlled state should change.
livebooleanfalseOpt into role="status" (or role="alert" for tone="error") for live-region announcement.
toneLabelstringtone nameScreen-reader tone word announced before the content.

Callout.Icon

NameTypeDefaultDescription
childrenReactNodetone iconCustom icon content (character, emoji, or SVG). The icon is decorative and aria-hidden.

Callout.Title

NameTypeDefaultDescription
childrenrequiredReactNodeTitle text for the callout.

Callout.Content

NameTypeDefaultDescription
childrenrequiredReactNodeBody content for the callout.

Callout.Dismiss

NameTypeDefaultDescription
childrenReactNode"[x]"Custom dismiss button content.

Accessibility

Notes

Compound Components

Compose Callout.Icon, Callout.Title, Callout.Content, and Callout.Dismiss as children. Each part inherits the tone from the root Callout via context.

Frame variants

frame="inline" (default): hairline border at tone color + subtle tone bg. frame="rail": no border, 2px inline-start rail at tone color. frame="bar": neutral border + 4px tone marker bar.

Default icons

Each tone ships a default character glyph (i / ! / ✕ / ✓), the same icon language Toast uses. Pass children to Callout.Icon to override with any ReactNode, including an SVG.

Dismissible

Add Callout.Dismiss as a child to show a close button. In uncontrolled mode the callout self-dismisses. For controlled mode, pass open and onOpenChange to the root Callout.

Accessibility

Static callouts have no role. Pass live to opt into role="status" (or role="alert" for tone="error") so assistive tech announces the message. A visually-hidden tone prefix ("Warning:", "Error:", …) is always rendered so the message is unambiguous without color.

Source

Install via CLI: pnpm exec dgadd add ui/callout. Keyboard hooks are included as standalone copies. For the full experience, use --integration keys.

Highlighted source loads after this disclosure opens. Browse the source repository.