Skip to Content

Announcement

News badge link for what's new and product updates: a pill built on the secondary Badge, with a headline that truncates first and a Learn more action beside a short divider. Renders as an anchor, suited to hero announcements.

View as Markdown
pnpm dlx shadcn add @01orbital/announcement

The example also imports @phosphor-icons/react from npm, which the install does not add:

pnpm add @phosphor-icons/react

Usage

import { Announcement } from "@/components/announcement/announcement"

Anatomy

Announcement is built from 3 parts. In the example they nest like this:

Announcement
├─ AnnouncementText
└─ AnnouncementAction
  • Announcement: A small pill that links to news, such as a launch, above a heading. It renders an <a> styled as the secondary Badge, at reading size. Put an AnnouncementText and an AnnouncementAction inside.
  • AnnouncementText: The headline inside Announcement. When space runs short it is cut off with an ellipsis, while AnnouncementAction keeps its full width.
  • AnnouncementAction: The call to action at the end of Announcement, such as "Learn more" and a caret icon. A short vertical rule sets it apart from AnnouncementText, and it never shrinks.

API reference

Announcement

A small pill that links to news, such as a launch, above a heading. It renders an <a> styled as the secondary Badge, at reading size. Put an AnnouncementText and an AnnouncementAction inside.

Over artwork, add className="dark" so the pill takes the dark theme's colors. Pass render to use your framework's link in place of the <a>.

It accepts the props of the Base UI part it wraps, and the HTML attributes of the element it renders.

AnnouncementText

The headline inside Announcement. When space runs short it is cut off with an ellipsis, while AnnouncementAction keeps its full width.

It accepts the HTML attributes of the element it renders.

AnnouncementAction

The call to action at the end of Announcement, such as "Learn more" and a caret icon. A short vertical rule sets it apart from AnnouncementText, and it never shrinks.

It accepts the HTML attributes of the element it renders.

Dependencies

npm: @base-ui/react, cn. The CLI installs them for you. cn merges Tailwind class names, in place of clsx and tailwind-merge.

Registry pieces it installs with it:

Used in blocks

5 blocks are built with Announcement: