Skip to content
opsinjs
Edit this page

Components

Callout

A short piece of set-apart information that helps you understand what you are reading without claiming anything about your health. A note, tip or caveat.

Usage

pnpm dlx shadcn@latest add @opsinjs/callout

The @opsinjs namespace is declared in your components.json. Everything it installs is code you then own. There is no runtime package to keep in step.

import { Callout } from "@/components/ui/callout"
<Callout variant="caveat" title="What this average leaves out">
  This average does not include days when you did not wear the device.
</Callout>

Examples

Theme
Density
Text
Status
Accent theme
Accent
callout · base base · style base-lyraOpen under the product theme

Next to what it explains

One callout per surface, directly under the thing it annotates, saying something specific and checkable. title names what the reader is about to be told.

Theme
Density
Text
Status
Accent theme
Accent
callout-next-to-what-it-explains · base base · style base-lyraOpen under the product theme
callout-next-to-what-it-explains.tsx
import { Callout } from "@/components/ui/callout"

export default function CalloutNextToWhatItExplains() {
  return (
    <div className="flex w-full max-w-(--opsin-measure-tight,45ch) flex-col gap-opsin-4">
      <h3 className="m-0 text-opsin-title3">Your weekly summary</h3>

      <p className="m-0 text-opsin-body">
        The summary above each section is worked out from the readings you have
        recorded in the last seven days, and it is redrawn every time a new one
        arrives.
      </p>

      <Callout variant="caveat" title="What this average leaves out">
        This average does not include days when you did not wear the device.
      </Callout>
    </div>
  )
}

On a card

The fill sets the callout apart, so bg-card behind it changes how much work the boundary does. The caller passes rounded-opsin-xs through className for the concentric inner radius.

Theme
Density
Text
Status
Accent theme
Accent
callout-on-a-card · base base · style base-lyraOpen under the product theme
callout-on-a-card.tsx
import { Callout } from "@/components/ui/callout"
import { Card } from "@/components/ui/card"

export default function CalloutOnACard() {
  return (
    <div className="w-full max-w-(--opsin-measure-tight,45ch)">
      <Card>
        <Card.Header
          title={<h3>How this section is put together</h3>}
          description="One supporting line, above the content it introduces."
        />
        <Card.Body className="flex flex-col gap-opsin-4">
          <p className="m-0 text-opsin-body">
            A card is the ordinary box most of a screen is made of. A callout
            inside one is set apart from the card, not from the page.
          </p>
          <Callout variant="tip" className="rounded-opsin-xs!">
            A tip is worth trying rather than worth knowing: put the callout
            beside the thing it explains, not at the foot of the screen where
            the reader has already stopped reading.
          </Callout>
        </Card.Body>
      </Card>
    </div>
  )
}

When to use it

Use it when

  • Setting apart a note, a tip or a caveat that helps the reader understand the content around it.
  • General health information that is true for everybody and is not about this reader's data.
  • Explaining a limitation of what is on screen: how a figure was worked out, what it leaves out, where it came from.

Do not use it when

  • The message is about this reader's data and carries a level of attention.Use status-pill instead.
  • Something has changed and the reader needs to know before carrying on.Use alert-banner instead.
  • The reader is being asked to do something by a certain time.Use care-card instead.
  • It is the standing statement about what this product is not.Use disclaimer-note instead.
  • You are explaining a single word rather than a passage.Use term instead.

Accessibility

It is a server component with no interactive elements, so the keyboard, focus and control criteria do not apply. role="note" gives it a start and end boundary, and a title supplies the accessible name through aria-label. It paints no colour from either axis and carries no clinical status, so greyscale and forced-colors take away nothing. Type sizes and colours are role tokens, the icon is sized in em, and the body reflows at 200% through min-w-0 and wrap-break-word rather than scrolling. Nothing in the source needed to change.

Residual items.

  • The variant glyph is aria-hidden, so the note, tip and caveat distinction reaches sighted readers alone. This is deliberate. Announcing the glyph name would not convey the sense either, so the copy is required to carry it, and both examples do.
  • The title renders as styled text rather than an h1 to h6, because the component cannot know its nesting level, but it stays exposed to assistive technology as the accessible name.
  • The four contrast pairs it paints are not yet measured, and the report below says so.
KeyActionNotes
TabSkips the calloutNo tab stop. A link inside the body is the stop, not the callout.
Shift+TabSkips the calloutSame in reverse. Never in the focus order.
EscapeDoes nothingThere is no dismiss control, so nothing closes.
Contrast: 36 measured token pairs, 15 below floor
PairThemeAPCA LcWCAG 2.2Floor
body text on the pagelight101.617.18:1Pass
body text on the pagedark-100.518.00:1Pass
body text on a cardlight104.717.96:1Pass
body text on a carddark-99.616.32:1Pass
body text on the muted groundlight98.116.32:1Pass
body text on the muted grounddark-97.513.77:1Pass
secondary text on the pagelight83.97.42:1Pass
secondary text on the pagedark-80.713.44:1Pass
secondary text on a cardlight87.07.76:1Pass
secondary text on a carddark-79.812.19:1Pass
secondary text on the muted groundlight80.47.05:1Pass
secondary text on the muted grounddark-77.810.28:1Pass
a hairline boundary on the pagelight19.31.41:1Below floor
a hairline boundary on the pagedark-8.21.90:1Below floor
a hairline boundary on a cardlight22.41.47:1Below floor
a hairline boundary on a carddark-7.31.72:1Below floor
a hairline boundary on the muted groundlight15.81.34:1Below floor
a hairline boundary on the muted grounddark0.01.45:1Below floor
a placeholder boundary on the pagelight69.84.52:1Pass
a placeholder boundary on the pagedark-51.07.62:1Pass
a placeholder boundary on a cardlight72.84.72:1Pass
a placeholder boundary on a carddark-50.16.91:1Pass
a placeholder boundary on the muted groundlight66.24.29:1Pass
a placeholder boundary on the muted grounddark-48.15.83:1Pass
a placeholder fill on the pagelight8.31.18:1Below floor
a placeholder fill on the pagedark-8.21.90:1Below floor
a placeholder fill on a cardlight11.41.23:1Below floor
a placeholder fill on a carddark-7.31.72:1Below floor
a placeholder fill on the muted groundlight0.01.12:1Below floor
a placeholder fill on the muted grounddark0.01.45:1Below floor
a placeholder boundary on its own filllight58.93.84:1Pass
a placeholder boundary on its own filldark-41.54.01:1Below floor
the card hairline on the pagelight69.84.52:1Pass
the card hairline on the pagedark-28.74.19:1Below floor
the card hairline on a cardlight72.84.72:1Pass
the card hairline on a carddark-27.93.80:1Below floor

These are the measured token pairs this component draws colour from, not a measurement of the component itself.

Props interface

Prop

Type

Generated from CalloutProps in registry/bases/base/callout.tsx.

There is no status, severity, color or warning variant, and no action or dismissible. The variant union is not exported, so a wrapper writes CalloutProps["variant"]. An axis colour in className is stripped before it reaches the root, and development warns once per offending class list.