Skip to content
shadcn.io is not affiliated with official shadcn/ui

Shadcn Announcement for React and Tailwind

Inline notice for short, prominent updates.

Releasev2.1.0 — Dark mode, faster builds, and 12 new components

Installation

bunx --bun shadcn@latest add https://kit.dev/r/announcement.json

Anatomy

Badge is composed in, not a part of this primitive. It is optional.

Announcement
├── Badge (optional)
└── AnnouncementTitle

Usage

import { Badge } from "@/components/ui/badge";
import {
  Announcement,
  AnnouncementTitle,
} from "@/components/ui/announcement";
<Announcement>
  <Badge>Release</Badge>
  <AnnouncementTitle>New feature added</AnnouncementTitle>
</Announcement>

Color comes from the nested Badge variant, not from Announcement.

Variants

Info

Success

Warning

Destructive

Examples

With icon

The asChild prop renders a link with announcement styling.

Without Badge

The announcement supports a title-only layout without the badge component.

API Reference

asChild merges props onto a single child element. Use it to render a link (<a> / Link) or button with announcement styles.

A direct child with data-slot="badge" tightens start padding (has-data-[slot=badge]:ps-0.5).

Announcement

Root. Renders a div with role="status" by default.

PropTypeDefaultDescription
role"status" | "alert""status"Live region politeness. "status" is polite. Use "alert" for urgent, interruptive messages.
asChildbooleanfalseMerge onto a single child (a, Link, or button). Adds pointer and hover styles.
classNamestring-Class names on the root.
AttributeDescription
data-slotannouncement
role"status" or "alert"

When asChild renders a or button, the root also gets a larger pointer-coarse hit target (min-h-11).

AnnouncementTitle

Primary message. Renders a span. Truncates with truncate when the row overflows.

PropTypeDefaultDescription
asChildbooleanfalseMerge onto a single child.
classNamestring-Class names on the title.
AttributeDescription
data-slotannouncement-title

Icons inside the title (for example an arrow) should be aria-hidden="true" when the text already describes the action.

Accessibility

Defaults to role="status" (polite live region). Use role="alert" only when the message must interrupt. This is the inverse of Alert, which defaults to "alert".

If the announcement is a link, keep the title text as the accessible name. Decorative icons and arrows should be aria-hidden="true".

Keyboard support

A static div is not in the tab order. With asChild on a link or button:

KeyDescription
EnterActivate the link or button.
SpaceActivate the button (and some links, depending on the browser).
TabMove to the announcement if it is a link or button.