---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Banner

A full-width accent pill that announces one thing, such as an app to install or a feature to switch on, with one action at its end, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `Banner`.

## When to use

- A full-width accent pill that announces one thing, such as an app to install or a feature to switch on, with one action at its end.
- 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.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-banner.json --yes
```

```text
Add the Goop Banner to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { useState } from 'react';
import { Banner, BannerAction, BannerDescription, BannerIcon, BannerTitle } from '@/components/ui/goop/banner';

function DesktopAppBanner({ onDownload }: { onDownload: () => void }) {
  const [open, setOpen] = useState(true);
  return (
    <div className="flex flex-col items-start gap-3">
      <Banner variant="warning" open={open} onDismiss={() => setOpen(false)}>
        <BannerIcon />
        <BannerTitle>Two visits have no crew</BannerTitle>
        <BannerDescription>Assign one before Monday.</BannerDescription>
      </Banner>
      <Banner variant="announcement" asChild>
        <a href="/changelog">
          <BannerIcon icon="grip" />
          <BannerTitle>New: plan visits on a map</BannerTitle>
        </a>
      </Banner>
      <Banner>
        <BannerIcon icon="tabler-outline:device-laptop" />
        <BannerTitle>Get the desktop app to record your site visits</BannerTitle>
        <BannerAction onClick={onDownload}>Download</BannerAction>
      </Banner>
    </div>
  );
}
```

- Fits: overview, settings: header.
- One banner at a time, at the top of the page or the settings section it concerns, above its first heading. A message about one section or record is an alert in the page; the result of something the person just did is a `Toast`.
- height, width, padding, gap, corner, border, background, text, motion: add no class for these.

## API reference

### Options

- `variant?: 'primary' | 'default' | 'info' | 'success' | 'warning' | 'destructive' | 'announcement' = 'primary'` — `primary` (the default): the full-width blue pill with its one action; `default`, `info`, `success`, `warning` or `destructive`: the same pill, quiet, in the kind's status tint, its icon the kind's own. Or: `announcement`: the small pill that is itself the one control (a button, or your link with `asChild`).
- `asChild?: boolean = false` — Draw the announcement on its one child element (a link) instead of a `button`; its parts go inside it.
- `open?: boolean` — Whether the banner is shown (shown when left out); false takes it off the page at once, true brings it back.
- `onDismiss?: () => void` — Called when the close is pressed; given, the full-width pill draws the close.
- `dismissLabel?: string = 'Dismiss'` — The close's spoken name, before the title's words: "Dismiss" unless given.

### Parts

- `BannerIcon` — The pack icon at the start, 18 px (12 px in the announcement), in the pill's ink (on a status kind the kind's role); decorative, the words say what it is about; icon?: IconName — A pack icon name, of the theme's main pack or its second (`tabler-outline:<name>`)
- `BannerTitle` — The announcement's words
- `BannerDescription` — The message, after the title
- `BannerAction` — The one action at the pill's end, 12 px before the close; takes asChild; also takes type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean

- data-slot values (to select a part by): banner, banner-action, banner-close, banner-content, banner-description, banner-icon, banner-title, banner-words

## Keyboard

- Enter / Space: on the action: run it

## Accessibility

- The native element answers the keyboard.
- hover, active: the browser's own (:hover, :active): write nothing
- focus-visible: the attribute data-focus-visible
- disabled: the prop disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## 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.

## Related

- [Progress](/themes/meadow/components/progress): A bar that fills as work goes on, for an upload or a setup with a known end, or that sweeps while the end is unknown.
- [Progress circle](/themes/meadow/components/progress-circle): Known progress as a ring that fills clockwise from the top.
- [Meter](/themes/meadow/components/meter): A bar showing a measurement inside a known range, such as storage used or a quota.
- [Stat](/themes/meadow/components/stat): A big figure with the word for what it counts, for a dashboard tile.
