shadcn.io is an independent project built on shadcn/ui
On this page9 sections
An announcement is a rounded pill that holds one line of news, usually with a Badge at its start naming what kind it is, such as a release or a maintenance window. It sits above a landing page's headline or at the top of an app, and it often links to the changelog entry or post with the details.
A message about what the reader is doing right now, such as a form that failed to save, belongs in an Alert.
Installation
Anatomy

Usage
<script setup lang="ts">
import { Badge } from "@/components/ui/badge";
import {
Announcement, AnnouncementTitle,
} from "@/components/ui/announcement";
</script>
<template>
<Announcement>
<Badge>Release</Badge>
<AnnouncementTitle>v2.1.0 adds dark mode</AnnouncementTitle>
</Announcement>
</template>
Accessibility
Announcement renders a div with role="status", a polite live region: when its text changes, a screen reader reads the new text after finishing what it was saying. Pass role="alert" for news that has to interrupt, such as an outage happening now. Made into a link with asChild, the pill has no role of its own, so the link keeps its role and its text, badge included, becomes its name. On a touch screen, a link or button announcement grows its hit area to at least 44 pixels tall. Mark decorative icons aria-hidden, as the demos do.
Demos
Variant default
The neutral case: a Release badge with variant set to default, in the primary color, beside a version line about dark mode, faster builds and new components. It looks the same as the preview at the top of the page, which leaves the prop out. Use it for ordinary product news that is neither a problem nor a deadline.
Variant destructive
A Payment failed badge, destructive with a warning triangle, beside a title saying the last invoice couldn't be processed and asking for new billing details. Keep this color for something that has already gone wrong and needs the reader to act. Keep the title short enough that the fix still shows, because a long one ends in an ellipsis where the pill runs out of room.
Variant info
Planned maintenance: an info badge with no icon, and a title giving tonight's two-hour downtime window and saying no action is needed. Info suits news the reader should know about but doesn't have to act on. When it does call for action, pick warning or destructive instead.
Variant success
A Deployed badge in success green with a check icon, beside the build time and an arrow, and the whole pill is a link. The announcement renders as the link through asChild, so the badge and the title are both part of what the reader clicks. Use it when good news has somewhere to go, such as the deploy's logs.
Variant warning
Trial ending, in a warning amber badge with a triangle icon, beside a line saying the free trial expires in 3 days. Nothing has failed yet, which is what separates it from destructive. Use it for a deadline the reader can still meet, and switch to the error color once the date has passed.
With icon
A New features badge in info with a sparkles icon before its label, beside a title about dark mode and 12 new components. The icon is aria-hidden, because the label already says what kind of news this is. Add one when it makes the kind of news recognizable at a glance, and skip it when the label is one plain word.
With link
The whole pill is one link, made with asChild, around a Latest update badge and a short title with an arrow. On hover the pill's background tints a little more, and keyboard focus draws a ring around it. Make the whole pill a link when the line teases a changelog entry or a blog post, and leave it as text when the news is complete where it stands.
Without badge
Only a title, saying new features were added and pointing to the logs, with no badge and no arrow, since the pill isn't a link. Without a badge the pill keeps its full start padding. Drop the badge when every line on the page would repeat the same word.
FAQ
What is an Announcement component used for?
It is a one-line pill of news, such as a release or planned maintenance, that usually sits above a landing page's headline or at the top of an app. A Badge at its start names the kind of news, AnnouncementTitle holds the sentence, and the whole pill often links to the post with the details.
For a message about what the reader is doing, such as a payment form that failed, use an Alert. A confirmation that should vanish after a few seconds is a toast from Sonner.
How do I make the whole Announcement a link in Vue?
Bind as-child to true on Announcement and put your link inside it as its only child, such as an <a> or a RouterLink, as the With link demo does. The pill's classes and attributes move onto the link, and it drops its status role so the link keeps its own. Written bare, as-child reaches the wrapper as an empty string: the link still renders, but with role="status" on it in place of its link role.
Keep the badge and the title inside the link. Its text is then the whole line, which is what a screen reader reads as the link's name, and the background tints on hover to show it can be clicked.
How do I change the Announcement color?
Change the variant of the Badge inside it. The values info, success, warning and destructive tint the badge, as the variant demos show, while the pill around it stays a neutral outline whatever the news.
Announcement has no variant of its own. To tint the pill too, add classes to it, such as a border and a faint background in the badge's color. They are merged with the built-in classes, so yours replace the neutral ones.
Can I use an Announcement without a badge or with an icon?
Yes to both. Leave the Badge out and the pill keeps its full start padding around the title, as in the Without badge demo. With a badge, the pill tightens that padding so the badge sits close to its rounded edge, and makes the badge a little taller to fill it.
An icon can go inside the badge before its label, as in With icon, or after the title's text, as an arrow on a link. Mark it aria-hidden when the words already say the same thing.
Does a screen reader read the Announcement out?
Yes, when its text changes. Announcement has role="status", a polite live region, so the screen reader reads the new text once it finishes what it was saying. An announcement that is there from the first load is read in order with the rest of the page, like any text.
Screen readers differ on a status that is added to the page with its text already in it. For news that arrives while someone is reading, change the text of a pill that is already there, or pass role="alert" when it has to interrupt, such as an outage happening now. A pill made into a link with asChild has no live region at all, since it takes the link's own role.
Why is my Announcement title cut off?
AnnouncementTitle keeps its text on one line, and the pill is never wider than its container. On a phone, a title as long as the one in Variant default ends in an ellipsis where the pill runs out of room.
A title that also holds an icon, such as an arrow, lays its children out in a row, where bare text can't end in an ellipsis and pushes the arrow out first. Put the text in a span with the truncate class, as Variant success does, and the text shrinks while the arrow stays. To let a title wrap instead, remove truncate from the classes of AnnouncementTitle in components/ui/announcement, which is your code once installed.
How do I center an Announcement above a hero heading?
Announcement is inline-flex, so it is only as wide as its badge and title, and it centers like text: text-center on its parent puts it in the middle. In a flex column, which stretches its children to full width by default, add items-center to the parent or self-center to the announcement.
The pill has no margin of its own, so give it a bottom margin, or a gap on the parent, to keep it off the heading.
API Reference
Announcement
<div> data-slot="announcement"
role?"status" | "alert"
The ARIA role of the announcement. With asChild it has none: the
link or button it renders as keeps its own. Ark default: status.
- Type
"status" | "alert"- Default
(asChild ? undefined : "status")
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
AnnouncementTitle
<span> data-slot="announcement-title"
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.










