Components

Callout

A boxed aside inside the content, for a tip, a note or a warning that should stand apart from the text around it.

Usage

import { IconInfoCircle } from '@tabler/icons-react'
import {
  Callout,
  CalloutDescription,
  CalloutIcon,
  CalloutTitle,
} from 'nyctoui/callout'

<Callout tone="blue">
  <CalloutIcon>
    <IconInfoCircle size={16} />
  </CalloutIcon>
  <CalloutTitle>Exports run overnight</CalloutTitle>
  <CalloutDescription>We’ll email you a link when the file is ready.</CalloutDescription>
</Callout>

A callout sits between paragraphs, next to what it is about. Every part but the description is optional: the icon gets its own column, level with the first line, and the title and description stack beside it. Text is 14px at a reading line height, so a description can run to a few lines, a list or a code sample.

It shares its tone and variant with Badge and Banner. For a notice about the whole page, use a Banner above it; for something that happened just now, a Toast; for words quoted from someone, a Blockquote.

Good for

  • A warning in a docs page before a command that deletes data.
  • A tip in a help center article, beside the step it’s about.
  • A note in a settings page explaining what a change affects.
  • A heads-up in an onboarding guide that a step needs admin rights.

Examples

Tones

neutral is for tips and asides. The hues are for status: blue for information, green for success, yellow and orange for warnings, red for something that can’t be undone.

Outline

variant="outline" draws a hairline instead of a fill, for a callout that should sit back further, or one placed on a tinted surface.

Longer content

CalloutDescription is a <div>, so it takes paragraphs, lists and inline code. Reset their margins; the callout spaces itself.

In running text

Between two paragraphs, as in a help article. One callout per screen keeps it noticeable; a page of them reads as noise.

Accessibility

A callout has role="note", which marks it as an aside to the main content. It isn’t a live region, so it is read in order with the page. The title is a <div> rather than a heading, so callouts don’t crowd the page’s outline; render a heading inside it if the callout should be one.

The icon is hidden from assistive technology and color never carries the meaning alone: say “This can’t be undone”, not only red.

Best practices

Do
  • Place it right next to the text or the control it is about.
  • Match the tone to the message: neutral or blue for a note, yellow or orange for a caution, red for something destructive.
  • Give it a short CalloutTitle when the description runs past a couple of lines, so people can skim it.
Don’t
  • Use a callout for a notice about the whole page or app; that’s a banner above the content.
  • Put several callouts in a row. If everything is highlighted, nothing is; fold them into the text.
  • Use it to quote someone. That’s a blockquote.

API reference

Callout

A <div role="note"> by default. Other props go to the element.

PropTypeDefault
tone
Color, as on Badge. Use a hue only for status.
'neutral' | 'red' | 'orange' | 'yellow' | 'green' | 'blue''neutral'
variant
A tinted fill, or a hairline around a transparent fill.
'soft' | 'outline''soft'
render
Renders another element, such as an <aside>, with the callout’s props.
ReactElement | (props) => ReactElement—
sx
StyleX styles merged after the built-in ones.
StyleXStyles—

CalloutIcon

A <span> slot for a 16px icon, level with the first line and hidden from assistive technology.

PropTypeDefault
sx
StyleX styles merged after the built-in ones.
StyleXStyles—

CalloutTitle

A <div> in medium weight. Other props go to the element.

PropTypeDefault
sx
StyleX styles merged after the built-in ones.
StyleXStyles—

CalloutDescription

A <div> for the body. Other props go to the element.

PropTypeDefault
sx
StyleX styles merged after the built-in ones.
StyleXStyles—