# Announcement pill

> A small pill link with an optional leading tag and a trailing arrow, set above a hero headline to point at a release or news item.

- Kind: ui · Category: Actions · Interactivity: none
- Install: `npx shadcn@latest add @haze/announcement-pill`
- File: `src/components/haze/ui/announcement-pill.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/tag, @haze/utils
- Docs page: https://hazeui.com/ui/announcement-pill

## Use when
- A hero headline needs one short pointer to a release, changelog entry or launch post above it.
- A feature or beta label should sit next to a one-line teaser that links onward.
- The pointer should stay inline with the page, not span the full width.

## Avoid when
- The message is a site-wide or dismissible notice across the top of the page; use banner.
- The label is only a status or count with no destination; use badge or tag.
- The action is the main call to action of the page; use button.

## Alternatives
- [banner](https://hazeui.com/ui/banner.md)
- [badge](https://hazeui.com/ui/badge.md)
- [tag](https://hazeui.com/ui/tag.md)
- [button](https://hazeui.com/ui/button.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| href | `string` | "#changelog" | no | Destination of the whole pill. Always rendered as a real link. |
| text | `string` | "Ledgerline 4.2 adds bank rules" | no | Announcement text. It wraps onto a second line on narrow screens. |
| tag | `string` | "New" | no | Short leading tag. Pass an empty string to hide it. |
| variant | `"default" \| "brand"` | "default" | no | Neutral pill or an emphasised muted pill with a solid tag. |
| arrow | `boolean` | true | no | Shows the trailing arrow, which nudges 2 px right on hover. |
| class | `string` |  | no | Extra classes, merged with tailwind-merge. |
| ...attributes | `HTML anchor attributes` |  | no | Passed to the <a>: target, rel, aria-label and so on. |

## Accessibility
- The whole pill is one anchor, so the tag, text and arrow read as a single link name such as "New Ledgerline 4.2 adds bank rules".
- The arrow is decorative and hidden from assistive technology; the tag text is part of the link name, so keep it meaningful.
- The pill is at least 28 px tall and has a visible focus ring. The muted fill keeps 4.5:1 text contrast.
- The arrow nudge and the press scale are switched off under prefers-reduced-motion.
- Key Enter: Follow the link

## Agent prompts

### Install and use

Install the Haze UI component "Announcement pill" with `npx shadcn@latest add @haze/announcement-pill`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AnnouncementPill from "@/components/haze/ui/announcement-pill.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/ui/announcement-pill.md

### Customize with real content

Adapt the Haze announcement-pill ui for our product. Replace the demo values of these props with our real content: href, text, tag, variant, arrow, class, ...attributes. Keep the layout, the heading level rules and these accessibility details: The whole pill is one anchor, so the tag, text and arrow read as a single link name such as "New Ledgerline 4.2 adds bank rules". The arrow is decorative and hidden from assistive technology; the tag text is part of the link name, so keep it meaningful. The pill is at least 28 px tall and has a visible focus ring. The muted fill keeps 4.5:1 text contrast. The arrow nudge and the press scale are switched off under prefers-reduced-motion. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using announcement-pill, check it fits: use it when a hero headline needs one short pointer to a release, changelog entry or launch post above it.; a feature or beta label should sit next to a one-line teaser that links onward.; the pointer should stay inline with the page, not span the full width.. Avoid it when the message is a site-wide or dismissible notice across the top of the page; use banner.; the label is only a status or count with no destination; use badge or tag.; the action is the main call to action of the page; use button.. Alternatives: @haze/banner, @haze/badge, @haze/tag, @haze/button.

## Example requests that should lead here
- Put an announcement pill above the hero headline that links to the 4.2 release notes.
- Add a brand-tinted pill with a Beta tag and no arrow above the page title.
- Show a pill that says what is new and wraps cleanly on a phone.

## Source

```astro
---
import { ArrowRight } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
import Tag from "./tag.astro";

interface Props {
  /** Where the pill leads, for example a changelog entry. Optional with a demo default ("#changelog"); the whole pill is one link. */
  href?: string;
  /** The announcement text. It wraps on narrow screens instead of being cut off. */
  text?: string;
  /** Short leading tag such as "New". Pass an empty string to leave it out. */
  tag?: string;
  /** default: neutral pill. brand: emphasised muted pill, for the one announcement that should stand out. */
  variant?: "default" | "brand";
  /** Trailing arrow that nudges right on hover. Decorative. */
  arrow?: boolean;
  class?: string;
  /** Any other anchor attribute, for example target, rel or aria-label. */
  [key: string]: unknown;
}

const {
  href = "#changelog",
  text = "Ledgerline 4.2 adds bank rules",
  tag = "New",
  variant = "default",
  arrow = true,
  class: className,
  ...rest
} = Astro.props;

const variants = {
  default: "border-frame bg-field text-foreground hover:border-frame-strong hover:bg-accent",
  brand: "border-frame-strong bg-muted text-foreground hover:bg-accent",
};
---

<a
  href={href}
  class={cn(
    "group inline-flex min-h-7 max-w-full min-w-0 items-center gap-2 rounded-full border py-1 text-[0.8125rem]/5 font-medium tracking-[-0.01em]",
    "transition-[background-color,border-color,scale] duration-150 ease-snappy motion-reduce:transition-none active:scale-[0.97] active:duration-75 motion-reduce:active:scale-100",
    "focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring",
    tag ? "ps-1" : "ps-3",
    arrow ? "pe-2.5" : "pe-3",
    variants[variant],
    className,
  )}
  {...rest}
>
  {tag && <Tag size="sm" variant="default" appearance={variant === "brand" ? "solid" : "soft"} class="shrink-0">{tag}</Tag>}
  <span class="min-w-0 text-pretty">{text}</span>
  {
    arrow && (
      <ArrowRight
        aria-hidden="true"
        class="size-3.5 shrink-0 transition-[translate] duration-200 ease-snappy group-hover:translate-x-0.5 motion-reduce:transition-none motion-reduce:group-hover:translate-x-0"
      />
    )
  }
</a>
```
