Badge
A status word in its own colour. Never interactive.
$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/badge.jsonTones
With dot
When to use
- The status of one row or tile: Disetujui, Menunggu HR, Ditolak, Dibatalkan.
- A short fact that changes over time: "Hangus 31 Des", "7 hari lagi", "Baru".
When not to use
- Something the user must read and act on → Callout (a sentence, not a word).
- A filter the user can click → SegmentedControl or Select (a Badge is never interactive).
- A count on a rail item → the count badge of AppShell.
Which one?
Do and don't
One word or two"Menunggu HR". The badge sits right of the row; the row text says the rest.
Use green for "good" numbersA Badge is a status, not a score. "7 hari" is neutral, not success.
Installation
Add Badge with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.
API
import { Badge } from "@/components/ui/badge"| Prop | Type | Default | Description |
|---|---|---|---|
tone | "success" | "warning" | "danger" | "info" | "neutral" | "neutral" | Closed set. |
dot | boolean | false | 6 px dot in the tone colour. |
children | ReactNode | – | 1–3 words, sentence case. |
className | string | – | Layout only. Never change colours. |