Badges essentials

badges-styled is a set of five decorative badge components (DotBadge, GradientBadge, GlowBadge, PulseBadge, OutlineBadge) built on the ai2 design tokens, with sizes sm to xl. Only PulseBadge animates, using framer-motion, and that animation stops when the user prefers reduced motion.

componentstyledbadgesregistry-item.json
Badges essentials
LIVE · running in a sandboxed iframe
Installed with shadcn add · 2 workarounds · theme from registry.json
  • applied the registry's theme (tokens, fonts and CSS from the registry preview settings)
  • installed base item https://ai2.design/r/tokens.json (registry preview settings)
See how it was built

Installation

pnpm dlx shadcn@latest add @ai2/badges-styled

Requires @ai2 in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { DotBadge, GradientBadge, GlowBadge, PulseBadge, OutlineBadge } from "@/components/ui/badges-styled"export function Example() {  return (    <div className="flex flex-wrap items-center gap-2">      <DotBadge size="md">Online</DotBadge>      <GradientBadge size="md">New</GradientBadge>      <GlowBadge size="md">Pro</GlowBadge>      <PulseBadge size="md">Live</PulseBadge>      <OutlineBadge size="md">Beta</OutlineBadge>    </div>  )}
  • Showing a status, tag, or label where a decorative accent is wanted on top of the base badge styling.
  • Marking a live or in-progress state with a pulsing indicator (PulseBadge), for example a 'Live' or 'Recording' label.
  • Highlighting a featured, new, or AI-generated item with a gradient or glowing accent (GradientBadge, GlowBadge).
  • Creating a lighter outlined tag (OutlineBadge) next to dense content where a filled badge would be too heavy.

Examples

Status row with a live indicator

A header showing a service status using DotBadge for the status and PulseBadge for a live feed label.

status-row-with-a-live-indicator.tsx
import { DotBadge, PulseBadge } from "@/components/ui/badges-styled"export function StatusHeader() {  return (    <header className="flex items-center gap-3">      <h2 className="text-lg font-semibold">Build pipeline</h2>      <DotBadge size="sm">Healthy</DotBadge>      <PulseBadge size="sm">Live</PulseBadge>    </header>  )}

Feature labels on a card

GradientBadge and OutlineBadge used to tag a product card with a featured marker and a version tag.

feature-labels-on-a-card.tsx
import { GradientBadge, OutlineBadge } from "@/components/ui/badges-styled"export function FeatureCard() {  return (    <article className="space-y-2 rounded-lg border p-4">      <div className="flex gap-2">        <GradientBadge size="lg">Featured</GradientBadge>        <OutlineBadge size="lg">v2.1</OutlineBadge>      </div>      <p className="text-sm">Autonomous summaries for your documents.</p>    </article>  )}

Glowing plan badge in a pricing table

GlowBadge marks the recommended plan, with an xl size for emphasis.

glowing-plan-badge-in-a-pricing-table.tsx
import { GlowBadge } from "@/components/ui/badges-styled"export function PlanTitle({ name }: { name: string }) {  return (    <div className="flex items-center justify-between">      <span className="font-semibold">{name}</span>      <GlowBadge size="xl">Recommended</GlowBadge>    </div>  )}

API reference

PropTypeDefaultDescription
size"sm" | "md" | "lg" | "xl""md"Controls height, gap, corner radius, horizontal padding, and text size. Exported as the StyledSize type. Applies to all five components.
classNamestring—Additional Tailwind classes merged onto the badge root span via cn(), after the base and size classes.
childrenReact.ReactNode—Label content rendered after the decorative indicator (if any). Text, icons, or both.
...propsReact.ComponentProps<"span">—All other native span attributes (id, aria-label, role, onClick, data-*, etc.) are spread onto the root span. The root always receives data-slot="styled-badge" before the spread.

Accessibility

  • Each badge renders a plain span with no implicit role. If the badge conveys status, pass role="status" or aria-label through props, or include the status as visible text in children.
  • DotBadge's green dot and PulseBadge's red dot are purely decorative and carry no text. Do not rely on their color alone to convey meaning; always include a text label in children.
  • PulseBadge's ring animation is removed when the user prefers reduced motion (checked with useReducedMotion from motion/react), so the dot stays static in that case.
  • Text contrast depends on the ai2 token values for info, brand, secondary, and background. Verify contrast for GradientBadge and GlowBadge, which use colored fills.
  • Icons inside the badge are sized to size-3 and text inside [&_i] is text-xs. Give icon-only usage an aria-label via props, since the badge has no built-in accessible name.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Badges essentials" component (ai2/badges-styled) from its shadcn registry.1. Install it with: npx shadcn@latest add @ai2/badges-styled2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, className, children, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { DotBadge, GradientBadge, GlowBadge, PulseBadge, OutlineBadge } from "@/components/ui/badges-styled"export function Example() {  return (    <div className="flex flex-wrap items-center gap-2">      <DotBadge size="md">Online</DotBadge>      <GradientBadge size="md">New</GradientBadge>      <GlowBadge size="md">Pro</GlowBadge>      <PulseBadge size="md">Live</PulseBadge>      <OutlineBadge size="md">Beta</OutlineBadge>    </div>  )}```

Files & dependencies

  • registry/ai2/styled/badges-styled.tsx→ components/ui/badges-styled.tsx
dependenciesmotion@^12.42.2
registryDependencies@ai2/tokens

Looks similar, elsewhere