Skip to content
Ballpoint

Badge

A word circled or coloured in: a pill pulled once around it, shaded, hatched or in red pen.

From shadcn/ui
NewDraftv1.2OverdueHover meA linkBoxed

Installation

pnpm dlx shadcn@latest add @ballpoint/badge

Usage

tsx
import { Badge } from "@/components/ui/badge"

<Badge>New</Badge>
<Badge variant="outline">v1.2</Badge>
<Badge variant="link" render={<a href="/changelog" />}>Changelog</Badge>

Examples

With icons

Glyphs and counts inside the badge.

Verified Heads up FailedUnread · 12

Status in a list

One variant per state, aligned to the right of each row.

  • Blue ballpoints, box of 50Paid
  • Cream notebooks, A5Pending
  • Fineliner setShipped
  • Legal pads, pack of 6Refunded

Sizes

Small, default and large, in three variants.

smdefaultlg
smdefaultlg
smdefaultlg

Filter chips

Badges rendered as toggle buttons: pressed ones are coloured in.

Showing letters, lists.

Removable tags

A close button inside the badge, and a way to put them back.

  • ink
  • paper
  • margins
  • coffee

API reference

variant
default "default"
"default" | "secondary" | "destructive" | "outline" | "ghost" | "link"

Coloured in, hatched, red pen, circled, circled on hover, or underlined.

render
ReactElement

Render as another element, e.g. a link.

size
default "default"
"sm" | "default" | "lg"

20, 24 or 32px high, with the type to match.

seed
string | number

Pins the drawing.

Pen settings

The drawing also takes draw, roughness, radius, fill, weight and speed, as props or from the nearest InkProvider. What each one does.