npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-banner.json --yesBanner
ProA full-width band across the top of the app or a page for one message that stays until it is no longer true, such as a trial ending, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- BannerIconThe kind's pack icon, 16 px, at the start, centred on the first line
- BannerTitleThe message's few words, in the medium weight, before the message on the same line
- BannerDescriptionThe message, after the title on the same line where it fits
- BannerActionThe caller's action after the words — the theme's small
Button(size="sm"
import { Banner, BannerIcon, BannerTitle, BannerDescription, BannerAction } from '@/components/ui/goop/banner';
import { useState, useEffect } from 'react';
import { AppFrame, AppFramePanel } from '@/components/goop/patterns/app-frame';
import { Button } from '@/components/ui/goop/button';
import { TopBar, TopBarRow, TopBarGroup, TopBarTitle } from '@/components/ui/goop/top-bar';
function TrialBanner() {
const [shown, setShown] = useState(true);
useEffect(() => {
if (sessionStorage.getItem('banner:trial-ends') !== null) setShown(false);
}, []);
return (
<AppFrame>
<AppFramePanel
header={
<>
<Banner
open={shown}
variant="warning"
onDismiss={() => {
sessionStorage.setItem('banner:trial-ends', 'closed');
setShown(false);
document.getElementById('page-title')?.focus();
}}
>
<BannerIcon />
<BannerTitle>Your trial ends in 3 days</BannerTitle>
<BannerDescription>Add a payment method to keep your projects.</BannerDescription>
<BannerAction>
<Button variant="outline" size="sm">
Add payment method
</Button>
</BannerAction>
</Banner>
<TopBar role="banner">
<TopBarRow>
<TopBarGroup>
<TopBarTitle id="page-title" tabIndex={-1}>
Projects
</TopBarTitle>
</TopBarGroup>
</TopBarRow>
</TopBar>
</>
}
>
<p>Three projects are due this week.</p>
</AppFramePanel>
</AppFrame>
);
}When to use
- A full-width band across the top of the app or a page for one message that stays until it is no longer true, such as a trial ending.
- Also called: announcement bar.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Banner on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-banner.json --yesAdd the Goop Banner to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { Banner, BannerIcon, BannerTitle, BannerDescription, BannerAction } from '@/components/ui/goop/banner';
import { useState, useEffect } from 'react';
import { AppFrame, AppFramePanel } from '@/components/goop/patterns/app-frame';
import { Button } from '@/components/ui/goop/button';
import { TopBar, TopBarRow, TopBarGroup, TopBarTitle } from '@/components/ui/goop/top-bar';
function TrialBanner() {
const [shown, setShown] = useState(true);
useEffect(() => {
if (sessionStorage.getItem('banner:trial-ends') !== null) setShown(false);
}, []);
return (
<AppFrame>
<AppFramePanel
header={
<>
<Banner
open={shown}
variant="warning"
onDismiss={() => {
sessionStorage.setItem('banner:trial-ends', 'closed');
setShown(false);
document.getElementById('page-title')?.focus();
}}
>
<BannerIcon />
<BannerTitle>Your trial ends in 3 days</BannerTitle>
<BannerDescription>Add a payment method to keep your projects.</BannerDescription>
<BannerAction>
<Button variant="outline" size="sm">
Add payment method
</Button>
</BannerAction>
</Banner>
<TopBar role="banner">
<TopBarRow>
<TopBarGroup>
<TopBarTitle id="page-title" tabIndex={-1}>
Projects
</TopBarTitle>
</TopBarGroup>
</TopBarRow>
</TopBar>
</>
}
>
<p>Three projects are due this week.</p>
</AppFramePanel>
</AppFrame>
);
}- Fits: overview, settings: header.
- One banner at a time per surface. A message about one section or record is
Alert; the result of an actionToast; a choice to make nowAlertDialog. In the app:header={<><Banner …/><TopBar role="banner">…</TopBar></>}; in a Card, a Sheet or a Dialog, its first child. Never size it. Onprimarythe action is the outline Button or a Link. - height, width, padding, gap, corner, border, background, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| variant | default | info | success | warning | destructive | primary = default | |
| open? | boolean | Whether the strip is shown (shown when left out). |
| onDismiss? | () => void | Called when the close is pressed; given, the close is drawn. |
| dismissLabel? | string = 'Dismiss' | The close's spoken name, before the title's words: "Dismiss" unless given. |
| Part | What it is |
|---|---|
| BannerIcon | The kind's pack icon, 16 px, at the start, centred on the first line; icon?: IconName — A pack icon name in place of the kind's |
| BannerTitle | The message's few words, in the medium weight, before the message on the same line; wraps, never cut |
| BannerDescription | The message, after the title on the same line where it fits; shown whole, never cut |
| BannerAction | The caller's action after the words — the theme's small Button (size="sm"; on primary variant="outline") or its Link — centred on the first line; on a phone under the words |
- Class recipes (cva): bannerVariants (Banner)
- data-slot values (to select a part by): banner, banner-action, banner-body, banner-content, banner-description, banner-fold, banner-icon, banner-inset, banner-title
Accessibility
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| expanded | the attribute data-state=open |
| open | the attribute data-state=open |
Motion
- The part sets its own motion: add no transition or animation of your own.
- How the theme moves, and how to move your own parts the same way: Motion.
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.