Skip to content

Callout

An aside inside a text: a note, a tip or a warning that the reader should not miss. It explains; it does not report something that just happened.

import { Callout, CalloutSkeleton } from '@sypnia/ui/react'

On this page
  1. Kinds
  2. Between paragraphs
  3. Skeleton
  4. When to use it
  5. For everyone
  6. Props

Kinds

Note, tip, confirmation, warning and danger.

Code
import { Callout } from '@sypnia/ui/react';

export default function Kinds() {
  return (
    <div className="sy-stack">
      <Callout title="Where tables live">Every table belongs to one project and is stored in the region of that project.</Callout>
      <Callout kind="tip" title="Start from a spreadsheet">Import a CSV file and Sypnia proposes the columns and their types.</Callout>
      <Callout kind="ok" title="Backups are on from the first day">You do not need to set anything up.</Callout>
      <Callout kind="warn" title="Secret keys skip your access rules">Use them on your servers only, never in a web page or a mobile app.</Callout>
      <Callout kind="danger" title="Deleting a project cannot be undone">Its tables, files and keys are removed at once. Export what you need first.</Callout>
    </div>
  );
}

Between paragraphs

Without a title it is one short remark.

An access rule is a condition. A person sees a row only when the condition is true for that row.

Rules apply to every request made with a public key, from the browser or from a mobile app.

Code
import { Callout } from '@sypnia/ui/react';

// An aside between paragraphs. Without a title it is one short remark.
export default function InText() {
  return (
    <div className="sy-stack sy-text--sm">
      <p>An access rule is a condition. A person sees a row only when the condition is true for that row.</p>
      <Callout kind="tip">Write the rule as a sentence first: «a customer sees only their own orders».</Callout>
      <p>Rules apply to every request made with a public key, from the browser or from a mobile app.</p>
    </div>
  );
}

Skeleton

The real piece and its skeleton: the same box, so nothing moves when the data arrives.

Code
import { Callout, CalloutSkeleton } from '@sypnia/ui/react';

// An aside whose words come from somewhere else. The skeleton has the same box as the real one, so nothing moves when the data arrives.
export default function Skeleton() {
  return (
    <div className="sy-stack">
      <Callout title="Backups run every night">The last one finished at 03:12 and took 4 minutes.</Callout>
      <CalloutSkeleton lines={1} />
    </div>
  );
}

When to use it

Use it when

  • Documentation, help and long forms: a fact that deserves to stand out from the paragraphs around it.
  • A consequence the reader must know before continuing: warn or danger.

Do not use it when

  • Something happened in the app (a save failed, a limit was reached): that is an Alert.
  • Every other paragraph would be one. When everything stands out, nothing does.
  • It carries the main content of the page: write that as normal text.

For everyone

  • It is a note (role="note"), not a landmark: a page with many callouts stays easy to navigate.
  • It is not announced by itself: it is read in order with the text.
  • Each kind has its own icon and, ideally, a title in words: «Deleting a project cannot be undone».

Props

CalloutTypeDefault
kind "danger" | "note" | "ok" | "warn" | "tip" note
title ReactNode
CalloutSkeletonTypeDefault
lines number 2
title boolean true
  1. Kinds
  2. Between paragraphs
  3. Skeleton
  4. When to use it
  5. For everyone
  6. Props

    Search pages, sections and terms