Skip to content
v1.4.2
Fit

Badge

A compact status or metadata label. Six semantic colors, soft-tinted by default or solid for high emphasis, with optional pill shape and status dot.

bash
jlds add badge

Usage

html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/jarooda/jlds@main/registry/css/index.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/jarooda/jlds@main/registry/css/badge.css">

<span class="jl-badge jl-badge--neutral">Badge</span>
vue
<script setup lang="ts">
import { Badge } from "@/components/ui/badge"
</script>

<template>
  <Badge color="neutral">Badge</Badge>
</template>
tsx
import { Badge } from "@/components/ui/badge"

<Badge color="neutral">Badge</Badge>

Colors

neutral · brand · success · warning · danger · info

html
<span class="jl-badge jl-badge--neutral">Neutral</span>
<span class="jl-badge jl-badge--brand">Brand</span>
<span class="jl-badge jl-badge--success">Success</span>
<span class="jl-badge jl-badge--warning">Warning</span>
<span class="jl-badge jl-badge--danger">Danger</span>
<span class="jl-badge jl-badge--info">Info</span>
vue
<template>
  <Badge color="neutral">Neutral</Badge>
  <Badge color="brand">Brand</Badge>
  <Badge color="success">Success</Badge>
  <Badge color="warning">Warning</Badge>
  <Badge color="danger">Danger</Badge>
  <Badge color="info">Info</Badge>
</template>
tsx
<Badge color="neutral">Neutral</Badge>
<Badge color="brand">Brand</Badge>
<Badge color="success">Success</Badge>
<Badge color="warning">Warning</Badge>
<Badge color="danger">Danger</Badge>
<Badge color="info">Info</Badge>

Solid

Add solid (React/Vue prop) or the jl-badge--solid class (HTML) for a filled, high-emphasis badge.

html
<span class="jl-badge jl-badge--solid jl-badge--brand">Brand</span>
<span class="jl-badge jl-badge--solid jl-badge--success">Success</span>
<span class="jl-badge jl-badge--solid jl-badge--danger">Danger</span>
vue
<template>
  <Badge solid color="brand">Brand</Badge>
  <Badge solid color="success">Success</Badge>
  <Badge solid color="danger">Danger</Badge>
</template>
tsx
<Badge solid color="brand">Brand</Badge>
<Badge solid color="success">Success</Badge>
<Badge solid color="danger">Danger</Badge>

Pill & dot

Add pill for fully-rounded corners and dot for a leading status dot.

html
<span class="jl-badge jl-badge--pill jl-badge--success">
  <span class="jl-badge__dot"></span>
  Online
</span>
<span class="jl-badge jl-badge--pill jl-badge--neutral">Pill</span>
vue
<template>
  <Badge pill dot color="success">Online</Badge>
  <Badge pill color="neutral">Pill</Badge>
</template>
tsx
<Badge pill dot color="success">Online</Badge>
<Badge pill color="neutral">Pill</Badge>

Dismissible

Provide onRemove (React) or removable + @remove (Vue) to render a trailing × — parity with Tag, for filter chips and token lists.

html
<span class="jl-badge jl-badge--pill jl-badge--brand">
  production
  <button type="button" class="jl-badge__remove" aria-label="Remove">
    <svg viewBox="0 0 16 16" fill="none"><path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.75" stroke-linecap="round"/></svg>
  </button>
</span>
vue
<template>
  <Badge v-for="t in tags" :key="t" color="brand" pill removable @remove="drop(t)">{{ t }}</Badge>
</template>
tsx
{tags.map((t) => (
  <Badge key={t} color="brand" pill onRemove={() => drop(t)}>{t}</Badge>
))}

Props

React

Badge extends React.HTMLAttributes<HTMLSpanElement> (so className, onClick, etc. pass through).

PropTypeDefaultDescription
color"neutral" | "brand" | "success" | "warning" | "danger" | "info""neutral"Semantic color
solidbooleanfalseFilled instead of tinted
pillbooleanfalseFully rounded
dotbooleanfalseShow a leading status dot
iconReact.ReactNodeLeading icon node
onRemove(e) => voidRenders a trailing × and makes the badge dismissible

Vue

PropTypeDefaultDescription
color"neutral" | "brand" | "success" | "warning" | "danger" | "info""neutral"Semantic color
solidbooleanfalseFilled instead of tinted
pillbooleanfalseFully rounded
dotbooleanfalseShow a leading status dot
removablebooleanfalseRender a trailing × that emits remove

Slots: default (label), icon (leading icon). Emits: remove.

CSS classes (HTML)

ClassPurpose
.jl-badgeBase class — always required
.jl-badge--neutral / --brand / --success / --warning / --danger / --infoColor
.jl-badge--solidFilled, high-emphasis style
.jl-badge--pillFully rounded corners
.jl-badge__dotLeading status dot element
.jl-badge__removeTrailing × button (dismissible)