Skip to main content
WireKit
Copy for LLM

Badge

A compact label for status, counts, or categorization. Badges are pill-shaped by default and come in six semantic intents.

Live Sandbox

This is a hydrated playground for the component. Toggle "Live preview" on the block below to swap the static HTML render for a real Livewire instance — every prop in the component's sandbox schema becomes an editable form field inside the iframe, so you can try different prop combinations live without writing any local code.

Sandbox
Beta

Basic Usage

Variants
Primary Success Warning Danger Info Neutral

Sizes

Sizes
Small Medium Large

Surfaces

The surface prop changes how the intent color is applied. soft (default) is the tinted chip; solid fills with the intent color and uses an on-color foreground; outline is transparent with an intent-colored ring. All three read the same semantic intent tokens, so they restyle automatically under any theme.

Soft surface (default)
Primary Success Warning Danger Neutral
Solid surface
Primary Success Warning Danger Neutral
Outline surface
Primary Success Warning Danger Neutral

With Dot Indicator

Use the dot prop to add a small colored dot to the left of the label. Useful for status indicators.

Status dots
Online Away Offline Idle

With Icons

Badges accept any content, including icons:

Badges with leading icons
Verified Pending Rejected Info

Width & Layout

Badges are inline elements that auto-size to their text content. They naturally flow within text or alongside other elements. By default a badge is a single-line, fixed-height pill — its text never wraps.

Multi-line labels

For a long label in a narrow space (a taxonomy chip in a table cell), set wrap. In wrap mode the badge swaps its fixed height for a minimum height plus vertical padding, so the pill grows with the wrapped text instead of the second line spilling below the surface. Without wrap, forcing white-space: normal alone leaves the extra lines outside the pill.

A wrapping badge grows to fit its label
Religious founders & spiritual teachers

Tooltip & Leading Icon

tooltip surfaces a supplementary explanation through WireKit's own Tooltip component — it appears on hover, focus, touch, and keyboard, and is announced to screen readers via aria-describedby (the badge label stays the accessible name). leadingIcon renders a decorative status glyph before the label. Every badge also carries a subtle depth shadow so it reads less flat.

Badge with tooltip + leading icon
Live
Pending
Failed

Trailing Icon & Dismissible

trailingIcon mirrors leadingIcon but renders after the label (handy for a link arrow). dismissible adds a keyboard-operable close button that removes the badge and dispatches a wirekit:badge-dismissed event — useful for removable filter chips. Override the button's accessible name with dismissLabel.

Trailing icon + dismissible chips
Read more Design Engineering

Props

Prop Type Default Description
intent string 'neutral' Semantic intent: primary, accent, neutral, success, warning, danger, info
size string 'md' sm, md, lg
surface string 'soft' soft (tinted chip), solid (filled + on-color text), or outline (transparent + ring)
dot bool false Shows a small colored dot before the label
tooltip string|null null Supplementary explanation, surfaced through the WireKit Tooltip component (hover / focus / touch / keyboard)
leadingIcon string|null null Decorative status glyph rendered before the label (icon alias, e.g. check / clock)
trailingIcon string|null null Decorative glyph rendered after the label (icon alias, e.g. arrow-right)
dismissible bool false Renders a keyboard-operable close button that removes the badge and dispatches wirekit:badge-dismissed
dismissLabel string 'Remove' Accessible name for the dismiss button
wrap bool false Multi-line mode — a long label wraps and the pill grows (min-height + padding) instead of clipping the second line
scope string|null null Scoped personalization name

Accessibility

  • Badges render as <span> elements — inline by default
  • The dot indicator has aria-hidden="true" (decorative — its color is the only signal, which is already expressed via the text intent)
  • For status badges that convey meaning beyond their color, ensure the text label describes the state clearly (e.g. "Online", "Error", "Expired")

Keyboard Interaction

This component is purely presentational and does not respond to keyboard input.

Pitfalls

  • Don't put interactive content inside a badge. Badges are inline <span> elements — for clickable status pills wrap them with a <x-wirekit::link> or use <x-wirekit::button size="sm" intent="..." />.

Design Tokens

Badges use tinted backgrounds via CSS color-mix() for a subtle, theme-aware look. All colors derive from semantic tokens:

Intent Background Text Border
primary --color-wk-accent (12% mix) --color-wk-accent-content --color-wk-accent (25%)
success --color-wk-success (12% mix) --color-wk-success-text --color-wk-success (25%)
warning --color-wk-warning (12% mix) --color-wk-warning-text --color-wk-warning (25%)
danger --color-wk-danger (12% mix) --color-wk-danger-text --color-wk-danger (25%)
info --color-wk-accent (8% mix) --color-wk-accent-content --color-wk-accent (20%)
neutral --color-wk-bg-muted --color-wk-text --color-wk-border-subtle

All intents automatically adapt to light/dark mode via the underlying tokens.

Customization

Override defaults without publishing views via config/wirekit.php:

'components' => [
    'badge' => ['intent' => 'primary', 'size' => 'lg'],
],

Or merge custom classes inline:

<x-wirekit::badge class="uppercase tracking-wider">Beta</x-wirekit::badge>

Usage & Conventions

Prop conventions — this component uses one or more of the shared semantic prop names (intent / variant / tone / surface). See Prop naming conventions for the canonical vocabulary, alias matrix, and decision tree.

Further Reading

Was this page helpful?

Voting requires cookies or local storage. What we store