Atoms / Banner

Banner

A page-level notice with an action, dismissible. The state always comes with a word.

import { Banner } from "@forgeron/ui";
/01 → Tones
Note
Scheduled maintenanceSaturday 21 November, 02:00 to 03:00 CET.
Done
Workspace restored.
import { Banner, Button } from "@forgeron/ui";

export default function Tones() {
  return (
    <div style={{ display: "grid", gap: 8 }}>
      <Banner title="Scheduled maintenance" dismissible>
        Saturday 21 November, 02:00 to 03:00 CET.
      </Banner>
      <Banner
        tone="warning"
        title="Your trial ends in 3 days."
        action={<Button size="sm">Choose a plan</Button>}
      />
      <Banner
        tone="danger"
        title="Payment failed."
        action={
          <Button size="sm" variant="danger">
            Update card
          </Button>
        }
      >
        We will retry tomorrow.
      </Banner>
      <Banner tone="success" title="Workspace restored." dismissible />
    </div>
  );
}
API → Props
PropTypeDefaultDescription
tone"info" | "success" | "warning" | "danger""info"Warning and danger are announced at once.
titleReactNode—The short line.
childrenReactNode—The detail.
actionReactNode—A button or link: the next thing to do.
dismissibleboolean—Shows a dismiss button.
open / defaultOpen / onOpenChangeboolean / boolean / (open) => voidtrueControlled or not.
onDismiss() => void—Hears the dismissal.
classNamestring—Extra classes.