npx shadcn@latest add https://sdk-components.thesqd.com/r/banner.jsonimport { Banner, type BannerVariant } from "@/components/ui/banner";import { Megaphone as MegaphoneIcon } from "@phosphor-icons/react/ssr";
import { Banner } from "@/components/ui/banner";
export function Example() {
return (
<Banner variant="brand" icon={<MegaphoneIcon weight="duotone" />} dismissible>
New workspace features are live. <a href="#">See what's new</a>
</Banner>
);
}Banner (single component — pass everything as props)
├── variant="default | brand | info | success | warning | destructive"
├── color="#rrggbb" (custom hex — overrides variant, soft-tinted)
├── icon={<LucideIcon />} (leading icon, optional)
├── children={<ReactNode>} (any content — the message)
├── action={<ReactNode>} (trailing element, e.g. a link/button)
├── solid={boolean} (solid full-color fill instead of soft tint)
├── centered={boolean} (center the content horizontally)
├── dismissible={boolean} (show an X — omit for a non-removable banner)
├── onDismiss={() => void} (fires when dismissed)
├── sticky={boolean} (stick to the top of the scroll container)
└── position="floating | top" (floating = inline · top = fixed full-width top bar)color hex prop.solid prop.| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "brand" | "info" | "success" | "warning" | "destructive" | "default" | Named color treatment. Drives border, background, text, and dark-mode classes. Ignored when `color` is set. |
color | string | — | Custom hex color (e.g. `#7c3aed`). Overrides `variant` — the banner derives a soft tinted background + border from it via color-mix. |
icon | ReactNode | — | Leading icon (typically a Phosphor icon). |
children | ReactNode | — | The banner content. Accepts strings or arbitrary JSX. |
action | ReactNode | — | Trailing element (link/button) rendered before the dismiss control. |
solid | boolean | false | Use a solid full-color fill with contrasting text instead of the soft tint. Works with named variants and with a custom `color` hex. |
centered | boolean | false | Center the content horizontally. Always on when `position="top"`. |
dismissible | boolean | false | Show a dismiss button that hides the banner (uncontrolled). Omit for a non-removable banner (the default — no dismiss control renders). |
onDismiss | () => void | — | Callback fired when the banner is dismissed. |
sticky | boolean | false | Stick the banner to the top of its scroll container (`sticky top-0 z-30`). Ignored when `position="top"`. |
position | "floating" | "top" | "floating" | Layout. `floating` flows inline in its container (full rounded outline). `top` pins the banner edge-to-edge across the very top of the page (`fixed inset-x-0 top-0`) with centered content — a system banner. |
className | string | — | Override or extend the resolved variant classes. |