Skip to main content
Urbicon UI

Badge

Compact labels for status, counts, and removable tags.

Playground

New
Variant
Size Style variant
Tier Style variant
<Badge>New</Badge>

01 Purpose

Three props shape a badge. purpose sets what it is, intent sets the colour, and variant sets how much weight it carries: a solid filled, a quiet soft, or a light outlined.

purposeWhat it rendersExample
status (default)A coloured label for an entity's state.Active
tagA neutral label for a category. Defaults intent to neutral, because a category carries no severity.Beta
counterA circular numeric pill for a count.8
dotA contentless indicator for presence or unread state.
chipAn action-styled label. With an onclick it becomes focusable and carries role="button"; without one it keeps the look and stays static.Clickable

removable is separate from purpose. It adds a dismiss button to any badge, so a tag or status can be removed too (see Filter chips below).

02 Examples

Status labels

An entity's state. Use soft for ambient lists and outlined where a table needs more contrast.
Active Pending Suspended Draft Published
<Badge variant="soft" intent="success">Active</Badge>
<Badge variant="soft" intent="warning">Pending</Badge>
<Badge variant="soft" intent="danger">Suspended</Badge>
<Badge variant="outlined" intent="neutral">Draft</Badge>
<Badge variant="outlined" intent="primary">Published</Badge>

Counters and dots on other components

Anchor a badge to an edge or corner of any position: relative parent with placement. Over a coloured surface, border cuts a ring in the page background so the badge stays legible.
8
AL
3
<div class="relative inline-block">
  <Button variant="filled" intent="primary">Messages</Button>
  <Badge intent="danger" purpose="counter" placement="top-end" border size="sm">8</Badge>
</div>
<div class="relative inline-block">
  <Avatar name="Ada Lovelace" randomColor />
  <Badge intent="danger" purpose="counter" placement="top-end" border size="sm">3</Badge>
</div>
<div class="relative inline-block">
  <Button variant="filled" intent="neutral">Alerts</Button>
  <Badge intent="success" purpose="dot" placement="top-end" border />
</div>

Filter chips

removable adds a dismiss button for user-applied filters or selected tags. Pair it with onRemove.
Active Premium Last 7 days
{#each filters as filter (filter)}
  <Badge
    variant="soft"
    intent="primary"
    removable
    onRemove={() => removeFilter(filter)}
    size="sm"
  >
    {filter}
  </Badge>
{/each}
{#if filters.length === 0}
  <span class="text-text-tertiary text-sm">No filters · </span>
  <button
    class="text-primary text-sm underline"
    onclick={() => (filters = ['Active', 'Premium', 'Last 7 days'])}
  >
    reset
  </button>
{/if}

Inline tags

purpose=tag keeps a category label neutral inside prose, and variant=outlined keeps it light against body text.

The Beta release adds support for OKLCH color tokens and a redesigned Tier API . Existing consumers can opt-in per component.

<p class="text-text-secondary text-sm leading-loose">
  The <Badge purpose="tag" variant="outlined" size="sm">Beta</Badge> release adds support for
  <Badge purpose="tag" variant="outlined" size="sm">OKLCH</Badge>
  color tokens and a redesigned
  <Badge purpose="tag" variant="outlined" size="sm">Tier API</Badge>. Existing consumers can
  opt-in per component.
</p>

03 Customization

Frosted glass

One class gives the badge a frosted-glass look for a dark or photographic background: a translucent fill, a hairline border, and a blur behind it. It keeps the pill shape and padding.
PRO Beta Live
<Badge size="sm" class="border-white/20 bg-white/15 text-white backdrop-blur-md">PRO</Badge>
<Badge size="sm" class="border-white/20 bg-white/15 text-white backdrop-blur-md">Beta</Badge>
<Badge size="sm" class="border-white/20 bg-white/15 text-white backdrop-blur-md">Live</Badge>

This is one of five ways to restyle a block. See Customization for class, slotClasses, unstyled, preset and provider-level overrides.

04 Accessibility

Built-in ARIA

The role follows purpose: status and dot render role="status", a polite live region that announces content changes; tag, counter and chip carry no role — a category, a count or a filter chip announces nothing when it changes, so it stays a plain span: a label inside a link rather than a live region inside one. Without purpose a badge keeps role="status", and so does the deprecated counter boolean. Only a badge with an onclick is announced as a button — a chip without a handler keeps the chip look but never claims an action it cannot perform. Removable badges include an accessible label for the remove button. Set role="status" for a count that must be announced when it changes, or role="alert" for a time-sensitive notification.

Keyboard

A badge with an onclick is focusable via Tab, carries role="button" and activates on Enter / Space; without a handler it takes no tab stop. On a removable badge the remove button takes focus, and Delete / Backspace there removes it.

05 API Reference

22 props
22 props 1 required
Prop
Type
Default
Description

06 Types

Local type definitions used by this component.

8 types
Name
Kind
Category
Used by
Description

07 Installation

Import

import { Badge } from '@urbicon-ui/blocks';