# Announcement banner

A responsive site announcement with native actions, optional consumer-owned dismissal, and opt-in text-only live updates.

Access: pro. Category: Feedback. Kind: composite.

## When to use

- Use it when a page needs a responsive site announcement with native actions, optional consumer-owned dismissal, and opt-in text-only live updates.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose alert instead when inline notices with icons, actions and optional dismissal is the actual interface need, rather than announcement banner.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Announcement banner

```sh
npx shadcn@latest add @tidal-pro/announcement-banner
```

Stylesheets: `components/ui/tidal.css`, `components/ui/announcement-banner.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/announcement-banner.css";
import{TidalAnnouncementBanner}from"./components/ui/announcement-banner";
export default()=><div className="tidal-scope"><TidalAnnouncementBanner description={"Demo"} label={"Demo"} title={"Demo"}/></div>;
```

## Structured props

- `TidalAnnouncementBanner.description: ReactNode`: Required description value accepted by this exported component.
- `TidalAnnouncementBanner.label: string`: Required label value accepted by this exported component.
- `TidalAnnouncementBanner.title: string`: Required title value accepted by this exported component.
- `TidalAnnouncementBanner.actions?: ReadonlyArray<TidalAnnouncementAction> | undefined` (default []): Optional actions value accepted by this exported component.
- `TidalAnnouncementBanner.actionsLabel?: string | undefined` (default "Announcement actions"): Optional actions label value accepted by this exported component.
- `TidalAnnouncementBanner.announce?: "assertive" | "polite" | undefined` (default "polite"): Optional announce value accepted by this exported component.
- `TidalAnnouncementBanner.announceText?: string | undefined`: Optional announce text value accepted by this exported component.
- `TidalAnnouncementBanner.badge?: ReactNode`: Optional badge value accepted by this exported component.
- `TidalAnnouncementBanner.dismissButtonProps?: NativeButtonProps | undefined`: Optional dismiss button props value accepted by this exported component.
- `TidalAnnouncementBanner.dismissButtonRef?: Ref<HTMLButtonElement> | undefined`: Optional dismiss button ref value accepted by this exported component.
- `TidalAnnouncementBanner.dismissDisabled?: boolean | undefined` (default false): Optional dismiss disabled value accepted by this exported component.
- `TidalAnnouncementBanner.dismissLabel?: string | undefined` (default "Dismiss announcement"): Optional dismiss label value accepted by this exported component.
- `TidalAnnouncementBanner.headingLevel?: HeadingLevel | undefined` (default 2): Optional heading level value accepted by this exported component.
- `TidalAnnouncementBanner.icon?: ReactNode`: Optional icon value accepted by this exported component.
- `TidalAnnouncementBanner.onDismiss?: ((event: React.MouseEvent<HTMLButtonElement>) => void) | undefined`: Callback invoked when the dismiss interaction is proposed.

## Complete usage example

[Source](https://tidalui.com/examples/announcement-banner.tsx) | [Manifest](https://tidalui.com/examples/announcement-banner.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useId, useLayoutEffect, useRef, useState } from "react";

import { TidalAnnouncementBanner, type TidalAnnouncementAction } from "./components/ui/announcement-banner";

import "./components/ui/announcement-banner.css";



const tidalExampleStyles = ".tidal-scope .announcement-demo,\n.tidal-scope .announcement-demo * {\n  box-sizing: border-box;\n}\n\n.tidal-scope .announcement-demo {\n  container: announcement-demo / inline-size;\n  display: grid;\n  width: min(100%, 980px);\n  min-width: 0;\n  gap: 14px;\n  margin-inline: auto;\n  padding: clamp(10px, 3vw, 28px);\n  color: var(--t-ink);\n}\n\n.tidal-scope .announcement-demo-header,\n.tidal-scope .announcement-demo-header > div,\n.tidal-scope .announcement-demo-restored,\n.tidal-scope .announcement-demo-restored > div,\n.tidal-scope .announcement-demo-details header,\n.tidal-scope .announcement-demo-footer {\n  min-width: 0;\n}\n\n.tidal-scope .announcement-demo-header {\n  display: flex;\n  min-height: 52px;\n  align-items: center;\n  justify-content: space-between;\n  gap: 14px;\n  padding-bottom: 10px;\n  border-bottom: 1px solid var(--t-border);\n}\n\n.tidal-scope .announcement-demo-header > div {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n}\n\n.tidal-scope .announcement-demo-header > div > span {\n  display: grid;\n  width: 40px;\n  height: 40px;\n  flex: 0 0 auto;\n  place-items: center;\n  border-radius: 10px;\n  background: var(--t-ink);\n  color: var(--t-surface);\n  font-size: 15px;\n  font-weight: 780;\n}\n\n.tidal-scope .announcement-demo-header > div > div {\n  display: grid;\n  min-width: 0;\n  gap: 2px;\n}\n\n.tidal-scope .announcement-demo :is(h2, p, strong, span) {\n  min-width: 0;\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .announcement-demo-header p,\n.tidal-scope .announcement-demo-header > span,\n.tidal-scope .announcement-demo-footer,\n.tidal-scope .announcement-demo-restored span,\n.tidal-scope .announcement-demo-details header span {\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.45;\n}\n\n.tidal-scope .announcement-demo-header h2 {\n  font-size: 18px;\n  font-weight: 640;\n  letter-spacing: -0.035em;\n}\n\n.tidal-scope .announcement-demo-stage {\n  display: grid;\n  min-width: 0;\n  gap: 10px;\n}\n\n.tidal-scope .announcement-demo-restored {\n  display: flex;\n  min-height: 82px;\n  align-items: center;\n  justify-content: space-between;\n  gap: 14px;\n  padding: 14px;\n  border: 1px dashed var(--t-border-strong);\n  border-radius: 18px;\n  background: var(--t-subtle);\n}\n\n.tidal-scope .announcement-demo-restored > div {\n  display: grid;\n  gap: 4px;\n}\n\n.tidal-scope .announcement-demo-restored strong {\n  font-size: 13px;\n}\n\n.tidal-scope .announcement-demo-restored button {\n  min-width: 88px;\n  min-height: 44px;\n  padding: 8px 14px;\n  border: 1px solid var(--t-ink);\n  border-radius: 10px;\n  background: var(--t-ink);\n  color: var(--t-surface);\n  font: inherit;\n  font-size: 11px;\n  font-weight: 700;\n  cursor: pointer;\n  transition: transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .announcement-demo-restored button:active {\n  transform: scale(0.97);\n}\n\n.tidal-scope .announcement-demo-restored button:focus-visible {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n.tidal-scope .announcement-demo-details {\n  display: grid;\n  min-width: 0;\n  max-height: 0;\n  gap: 12px;\n  padding-inline: 16px;\n  overflow: hidden;\n  border: 1px solid transparent;\n  border-radius: 16px;\n  opacity: 0;\n  background: var(--t-subtle);\n  transform: translateY(-5px);\n  transition:\n    max-height 420ms var(--t-ease-out),\n    padding 320ms var(--t-ease-out),\n    border-color 240ms,\n    opacity 240ms,\n    transform 320ms var(--t-ease-out);\n}\n\n.tidal-scope .announcement-demo-details[data-open] {\n  max-height: 260px;\n  padding-block: 16px;\n  border-color: var(--t-border);\n  opacity: 1;\n  transform: none;\n}\n\n.tidal-scope .announcement-demo-details header {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 12px;\n}\n\n.tidal-scope .announcement-demo-details header strong {\n  font-size: 13px;\n}\n\n.tidal-scope .announcement-demo-details ol {\n  display: grid;\n  min-width: 0;\n  grid-template-columns: repeat(2, minmax(0, 1fr));\n  gap: 8px;\n  margin: 0;\n  padding: 0;\n  list-style: none;\n}\n\n.tidal-scope .announcement-demo-details li {\n  display: grid;\n  min-width: 0;\n  grid-template-columns: 30px minmax(0, 1fr);\n  align-items: start;\n  gap: 9px;\n  padding: 10px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  background: var(--t-surface);\n}\n\n.tidal-scope .announcement-demo-details li span {\n  display: grid;\n  width: 30px;\n  height: 30px;\n  place-items: center;\n  border-radius: 8px;\n  background: var(--t-ink);\n  color: var(--t-surface);\n  font-size: 11px;\n  font-weight: 740;\n}\n\n.tidal-scope .announcement-demo-details li p {\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.5;\n}\n\n.tidal-scope .announcement-demo-footer {\n  display: flex;\n  justify-content: space-between;\n  gap: 12px;\n}\n\n@container announcement-demo (max-width: 520px) {\n  .tidal-scope .announcement-demo-header > span {\n    display: none;\n  }\n\n  .tidal-scope .announcement-demo-details ol {\n    grid-template-columns: minmax(0, 1fr);\n  }\n\n  .tidal-scope .announcement-demo-restored,\n  .tidal-scope .announcement-demo-footer {\n    align-items: stretch;\n    flex-direction: column;\n  }\n\n  .tidal-scope .announcement-demo-restored button {\n    width: 100%;\n    font-size: 16px;\n  }\n}\n\n@media (pointer: coarse) {\n  .tidal-scope .announcement-demo-restored button {\n    font-size: 16px;\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .announcement-demo-restored button,\n  .tidal-scope .announcement-demo-details {\n    transition: none;\n  }\n\n  .tidal-scope .announcement-demo-restored button:active,\n  .tidal-scope .announcement-demo-details {\n    transform: none;\n  }\n}";

export function AnnouncementBannerDemo() {
  const instanceId = useId().replace(/:/g, "");
  const headingId = `${instanceId}-workspace-heading`;
  const detailsId = `${instanceId}-release-details`;
  const [visible, setVisible] = useState(true);
  const [detailsOpen, setDetailsOpen] = useState(false);
  const [status, setStatus] = useState("The release note is ready to review.");
  const [focusIntent, setFocusIntent] = useState<"dismiss" | "restore" | null>(
    null,
  );
  const dismissRef = useRef<HTMLButtonElement>(null);
  const restoreRef = useRef<HTMLButtonElement>(null);

  useLayoutEffect(() => {
    if (focusIntent === "dismiss" && visible)
      dismissRef.current?.focus({ preventScroll: true });
    if (focusIntent === "restore" && !visible)
      restoreRef.current?.focus({ preventScroll: true });
    setFocusIntent(null);
  }, [focusIntent, visible]);

  const actions: readonly TidalAnnouncementAction[] = [
    {
      id: "changes",
      kind: "button",
      label: detailsOpen ? "Hide changes" : "View changes",
      emphasis: "primary",
      buttonProps: {
        "aria-expanded": detailsOpen,
        "aria-controls": detailsId,
        onClick: () => {
          setDetailsOpen((current) => !current);
          setStatus(
            detailsOpen
              ? "Release details are hidden."
              : "Release details are visible below.",
          );
        },
      },
    },
    {
      id: "guide",
      kind: "link",
      href: `#${detailsId}`,
      label: "Open setup note",
      anchorProps: {
        onClick: () => {
          setDetailsOpen(true);
          setStatus("The local setup note is open.");
        },
      },
    },
  ];

  return (
    <section className="announcement-demo" aria-labelledby={headingId}>
      <header className="announcement-demo-header">
        <div>
          <span aria-hidden="true">T</span>
          <div>
            <p>Sample workspace</p>
            <h2 id={headingId}>Release notes</h2>
          </div>
        </div>
        <span>October update</span>
      </header>

      <div className="announcement-demo-stage">
        {visible ? (
          <TidalAnnouncementBanner
            label="Workspace release announcement"
            title="Review queue update"
            description="Group feedback by project and archive completed notes."
            badge="New in this sample"
            actions={actions}
            onDismiss={() => {
              setVisible(false);
              setStatus("The release announcement was dismissed locally.");
              setFocusIntent("restore");
            }}
            dismissButtonRef={dismissRef}
          />
        ) : (
          <div className="announcement-demo-restored">
            <div>
              <strong>Announcement hidden</strong>
              <span>The sample workspace remains unchanged.</span>
            </div>
            <button
              ref={restoreRef}
              type="button"
              onClick={() => {
                setVisible(true);
                setStatus("The release announcement is visible again.");
                setFocusIntent("dismiss");
              }}
            >
              Restore
            </button>
          </div>
        )}

        <article
          id={detailsId}
          className="announcement-demo-details"
          data-open={detailsOpen || undefined}
          aria-hidden={!detailsOpen}
          inert={!detailsOpen ? true : undefined}
        >
          <header>
            <span>Local setup note</span>
            <strong>Review queue</strong>
          </header>
          <ol>
            <li>
              <span>01</span>
              <p>Open a project and choose Review.</p>
            </li>
            <li>
              <span>02</span>
              <p>Resolve or archive each sample note.</p>
            </li>
          </ol>
        </article>
      </div>

      <footer className="announcement-demo-footer">
        <p role="status" aria-live="polite">
          {status}
        </p>
        <span>Sample data. Changes stay in this preview.</span>
      </footer>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <AnnouncementBannerDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

label, title and description define the named announcement region and visible copy. headingLevel defaults to h2. Optional badge and decorative icon preserve numeric zero. actions is an ordered consumer-owned list of unique IDs and native button or real-anchor actions; each action supports visible label content, emphasis, disabled state, native attributes and the matching ref. Enabled anchors retain href, modifiers, download and target behavior, while action disabled or anchor aria-disabled true prevents navigation before the consumer handler. onDismiss opts into a native dismiss button with caller-first preventable buttonProps, label, disabled state and ref; visibility remains consumer-owned. Optional announceText creates a text-only polite or assertive live region without exposing actions. The source owns no timers, data, requests, navigation, focus, network or storage state.
