Skip to content
All components
Primitives

Badge group

Pair a short badge with a one-line message, such as 'New' and an announcement, often as a link to more detail.

A pill that pairs a short badge with a message, optionally as a link.

Installation

tdpxl is not an npm dependency of your app. The @tdpxl/cli command (not published to npm yet) copies the source into your project, with the registry items and npm packages it imports.

npx @tdpxl/cli add badge-group

Then import it from @/components/ui/badge-group. New project? Start with the installation guide.

Examples

Each example is one branch of the official demo, rendered in its own frame. The code is that branch as you would write it, with imports pointing at the default install paths.

Link

Render the whole badge group as a real link through asChild. The badge and message form the link name; the arrow moves on hover except under reduced motion. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { BadgeGroup, BadgeGroupArrow, BadgeGroupBadge, BadgeGroupMessage } from "@/components/ui/badge-group"

export function BadgeGroupLink() {
  return (
    <div className="flex w-full max-w-md flex-col items-start gap-6">
      <BadgeGroup asChild>
        <a href="#changelog">
          <BadgeGroupBadge>New</BadgeGroupBadge>
          <BadgeGroupMessage>Dark mode is here</BadgeGroupMessage>
          <BadgeGroupArrow />
        </a>
      </BadgeGroup>
    </div>
  )
}

Colors

Compare badge group color roles with readable messages. The words, not the color, say what the message is about. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { BadgeGroup, BadgeGroupBadge, BadgeGroupMessage } from "@/components/ui/badge-group"

export function BadgeGroupColors() {
  return (
    <div className="flex w-full max-w-md flex-col items-start gap-6">
      <div className="flex flex-col items-start gap-2">
        <BadgeGroup color="neutral">
          <BadgeGroupBadge>Update</BadgeGroupBadge>
          <BadgeGroupMessage>Version 2.4 is available</BadgeGroupMessage>
        </BadgeGroup>
        <BadgeGroup color="success">
          <BadgeGroupBadge>Live</BadgeGroupBadge>
          <BadgeGroupMessage>All systems operational</BadgeGroupMessage>
        </BadgeGroup>
        <BadgeGroup color="warning">
          <BadgeGroupBadge>Notice</BadgeGroupBadge>
          <BadgeGroupMessage>Maintenance on Sunday</BadgeGroupMessage>
        </BadgeGroup>
        <BadgeGroup color="error">
          <BadgeGroupBadge>Outage</BadgeGroupBadge>
          <BadgeGroupMessage>Exports are delayed</BadgeGroupMessage>
        </BadgeGroup>
      </div>
    </div>
  )
}

Trailing badge

Place the badge after the message for a call to action. The padding swaps automatically so the badge meets the edge. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { BadgeGroup, BadgeGroupArrow, BadgeGroupBadge, BadgeGroupMessage } from "@/components/ui/badge-group"

export function BadgeGroupTrailingBadge() {
  return (
    <div className="flex w-full max-w-md flex-col items-start gap-6">
      <BadgeGroup asChild color="information">
        <a href="#pricing">
          <BadgeGroupMessage>See what changed in the pricing</BadgeGroupMessage>
          <BadgeGroupBadge>
            Read more
            <BadgeGroupArrow className="ms-0" />
          </BadgeGroupBadge>
        </a>
      </BadgeGroup>
    </div>
  )
}

Sizes

Compare the medium and large badge group sizes. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { BadgeGroup, BadgeGroupBadge, BadgeGroupMessage } from "@/components/ui/badge-group"

export function BadgeGroupSizes() {
  return (
    <div className="flex w-full max-w-md flex-col items-start gap-6">
      <div className="flex flex-col items-start gap-2">
        <BadgeGroup size="md" color="highlight">
          <BadgeGroupBadge>Beta</BadgeGroupBadge>
          <BadgeGroupMessage>Medium size</BadgeGroupMessage>
        </BadgeGroup>
        <BadgeGroup size="lg" color="highlight">
          <BadgeGroupBadge>Beta</BadgeGroupBadge>
          <BadgeGroupMessage>Large size</BadgeGroupMessage>
        </BadgeGroup>
      </div>
    </div>
  )
}

Long message

Wrap a long message inside a narrow container instead of truncating it, so the full announcement stays readable. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { BadgeGroup, BadgeGroupArrow, BadgeGroupBadge, BadgeGroupMessage } from "@/components/ui/badge-group"

export function BadgeGroupLongMessage() {
  return (
    <div className="flex w-full max-w-md flex-col items-start gap-6">
      <div className="w-64">
        <BadgeGroup asChild>
          <a href="#release">
            <BadgeGroupBadge>New</BadgeGroupBadge>
            <BadgeGroupMessage>A long announcement wraps onto a second line instead of being cut off</BadgeGroupMessage>
            <BadgeGroupArrow />
          </a>
        </BadgeGroup>
      </div>
    </div>
  )
}

API reference

Generated from the component's TypeScript signatures. Inherited DOM and primitive props are listed separately.

BadgeGroup

A pill that pairs a short badge with a message, such as "New" and an announcement. Render a link with asChild.

BadgeGroup props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
color"primary" | "neutral" | "error" | "success" | "warning" | "information" | "highlight" | null | undefined"primary"Semantic color role shared by the pill, its badge and its text. Pair the color with words that carry the meaning.
size"md" | "lg" | null | undefined"md"md is 28px tall with extra-small text; lg is 32px tall with small text.
asChildboolean | undefinedfalseMerge into one child, usually an anchor or router Link, so the whole pill becomes that link. Keep its href and visible text.
Inherited props (13)
BadgeGroup inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
refReact.Ref<HTMLSpanElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLSpanElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLSpanElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLSpanElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLSpanElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

BadgeGroupArrow

A decorative trailing arrow for linked groups. It mirrors in right-to-left layouts and moves on hover.

BadgeGroupArrow props
PropTypeDefaultDescription
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (14)
BadgeGroupArrow inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
maxstring | number | undefined—Maximum supported numeric value.
minstring | number | undefined—Minimum supported numeric value.
namestring | undefined—Name used by the control's form submission or primitive form integration.
typestring | undefined—Native element or primitive mode defined by the source union. Choose a supported value; its meaning depends on the component.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<SVGSVGElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<SVGSVGElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<SVGSVGElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<SVGSVGElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<SVGSVGElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<SVGSVGElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
refReact.Ref<SVGSVGElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

BadgeGroupBadge

The inner badge, such as "New" or "v2.0". Place it first for a leading badge or last for a trailing one.

BadgeGroupBadge props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
BadgeGroupBadge inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLSpanElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLSpanElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLSpanElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLSpanElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLSpanElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

BadgeGroupMessage

The message. It wraps instead of truncating, so the full text stays readable.

BadgeGroupMessage props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (13)
BadgeGroupMessage inherited props
PropTypeDefaultDescription
refReact.Ref<HTMLSpanElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLSpanElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLSpanElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLSpanElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLSpanElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

Accessibility & usage

From registry/ui/badge-group.meta.json (authored guidance; human review may still be pending). Behavior is checked by Storybook tests, not certified here.

When to use

  • Announce a release, feature or event above a page heading.
  • Point to a changelog, pricing change or status page with a single link.
  • Label a short message with a category, version or status word.

When not to use

  • A status that needs an icon, a description and actions; use an alert.
  • A plain category or count; use a badge.
  • Several links in a row; use regular links or buttons.

Anatomy

BadgeGroup
Pill with color (semantic role) and size; a link when asChild is set.
BadgeGroupBadge
Inner badge; first for a leading badge, last for a trailing one.
BadgeGroupMessage
Message text that wraps.
BadgeGroupArrow
Decorative trailing arrow; mirrors in right-to-left layouts.

Keyboard & interaction

  • Passive unless rendered as a link with asChild; links activate with Enter.
  • A linked group shows a visible focus outline and a hover tint.
  • The arrow nudges on hover; the movement is removed under prefers-reduced-motion.

Responsive behavior

  • The message wraps inside narrow containers; the pill never forces horizontal scrolling.
  • Keep the message short so it stays on one line on most screens.

Content guidelines

  • Keep the badge to one or two words: 'New', 'Beta', 'v2.4'.
  • Write the message as a short statement of what changed.
  • Link text must make sense on its own; avoid 'Click here'.

Alternatives

  • Badge — A single short status or category without a message.
  • Alert — A status message that needs a description or actions.
  • Button — A primary call to action.

Resources