Skip to content

Badge

Download .md

A badge shows the status of an item, such as a release or a document, or a short label such as “Baru”.

  • Use the status variants for the state of a record: success, warning, info, destructive.
  • Always put the status in words; color alone never carries a status.
  • Use default or outline for labels that are not a status.
  • Don’t use a badge as a button.
React
SelesaiMenungguInfoDitolakBaruDraf
Vue
Selesai
Menunggu
Info
Ditolak
Baru
Draf
DoName the status in words, with its color as a second signal.
Don'tDon't show a status by color alone; not everyone can tell the colors apart.
123
  1. 1Status color text
  2. 2Soft background
  3. 3Outline variant

Short text, text-xs medium, on radius-sm (6px). Badges are never pills. Status badges use the soft fill of their status with the status color as text.

Variant Looks Use it for
success success text on success-soft Done, approved, published.
warning warning text on warning-soft Pending, waiting for review.
info info text on info-soft Neutral information.
destructive destructive text on destructive-soft Rejected, failed, cancelled.
default primary fill A label in the product color, such as “Baru”.
secondary secondary fill A quiet label.
outline border outline A label that should stay in the background, such as “Draf”.
ghost No fill until hover A quiet label inside a link or a menu.
link primary-text, underlined on hover A badge that is itself a link.

The default badge on Cover Clearance orange uses the same contrast exception as the primary button. Keep its label short.

React Vue Flutter Type Default Use
variant variant named constructor, or backgroundColor + foregroundColor for status see Variants default Meaning and weight.
render as / as-child child element span Renders the badge as another element, such as a link.
import { Badge } from "@/components/ui/badge"
export default function BadgeDemo() {
return (
<div className="flex flex-wrap items-center gap-2">
<Badge variant="success">Selesai</Badge>
<Badge variant="warning">Menunggu</Badge>
<Badge variant="info">Info</Badge>
<Badge variant="destructive">Ditolak</Badge>
<Badge>Baru</Badge>
<Badge variant="outline">Draf</Badge>
</div>
)
}
Terminal window
npx shadcn@latest add https://design.sosialoka.tech/r/react/badge.json
  • Badge text is read as normal text; keep it meaningful on its own.
  • Status colors pass 4.5:1 on their soft fill in every theme.