Skip to content

Badge

⋯

Badge is the single display component for the Figma Badge and Badge & Chip/Tag designs. variant selects the visual anatomy. The consumer supplies visible text and any course logo.

import { Badge } from "@nesra/ui/badge";
export function Status() {
return (
<Badge appearance="outline" status="verified" variant="status">
Terverifikasi
</Badge>
);
}

Badge is also exported from @nesra/ui.

The Figma Soft and Fill label treatments map to appearance="soft" and appearance="fill". Figma colors map to lowercase color values. Figma Purple is bound to the Categorical Violet roles.

brandbrand
infoinfo
successsuccess
warningwarning
errorerror
neutralneutral
purplepurple

sm targets 20px height and 12px text. md targets 24px height and 14px text. startIcon and endIcon render decorative content.

SmallMediumWith icon

startIcon and endIcon are decorative. Keep the visible label meaningful without them.

VerifiedAttentionDetailsComplete

onRemove adds a remove button after a label badge. With onRemove, endIcon becomes the button’s icon, and the default icon is X. The page removes the badge from its own state in the handler.

  • 03 Oct 2026
  • 10 Oct 2026
  • 17 Oct 2026

Badges can sit beside ordinary text without changing the text’s semantics.

Course catalog New

Payment Terverifikasi

Wrap a Badge in a native anchor for navigation. The anchor owns the destination and keyboard focus.

The Figma Mini Badge is variant="indicator". It has dot and check treatments with 8, 12, 16, and 20px diameters.

status selects the pending, verified, or canceled palette and icon. appearance selects filled or outlined treatment. The text is supplied through children.

Menunggu PembayaranMenunggu Pembayaran
TerverifikasiTerverifikasi
DibatalkanDibatalkan

course uses three sizes. Pass the course logo through startIcon; the preview uses a generic spreadsheet icon.

Microsoft ExcelMicrosoft ExcelMicrosoft Excel
Google SheetsGoogle SheetsGoogle Sheets

xpState changes the visual state. active shares the default blue treatment; the supplied text distinguishes the claim prompt. A claimed badge shows a check. An actual claim action needs a separate control.

50XPKlaim 50XP50XP
50XPKlaim 50XP50XP

level changes the highlighted bars. sm and md change padding around the same 12px text.

MudahSedangSulit
MudahSedangSulit

Badge follows the page theme. Dark applies when an ancestor has the dark class or data-theme="dark".

Badge Fill Text
Brand soft Foundation/bg-brand-primary-50 Text/text-body
Brand fill Foundation/bg-brand-primary Text/text-on-brand
Info soft Categorical/Blue/subtle Text/text-link, icons Icon/icon-info
Info fill, XP, Verified Foundation/bg-info-solid Text/text-staticWhite
Success soft Categorical/Green/subtle Categorical/Green/foreground
Success fill Foundation/bg-success-solid Text/text-staticWhite
Warning soft Categorical/Yellow/subtle Categorical/Yellow/foreground, icons Icon/icon-warning
Warning fill, Pending Categorical/Yellow/base Text/text-staticDark
Error soft Categorical/Red/subtle Categorical/Red/foreground, icons Icon/icon-destructive
Error fill Action/destructive-default Text/text-staticWhite
Neutral soft Foundation/bg-gray Text/text-body
Neutral fill Categorical/Neutral/base Text/text-staticWhite
Purple soft Categorical/Violet/subtle Text/text-body, icons Icon/icon-neutral
Purple fill Categorical/Violet/base Text/text-staticDark, icons Icon/icon-staticDark
Canceled status Foundation/bg-disabled Text/text-tertiary, icon Icon/icon-muted
Claimed XP Surface/card-bg-gray Text/text-support

The soft fills and the Brand fill change between modes. The solid Info, Success, Warning, Error, Neutral, and Purple fills keep the same color in both modes, so their static text colors stay readable. The indicator is Foundation/bg-success-solid with a Foundation/bg-neutral border and check, so it stays separated from the page in both modes. The remove button shows Box Shadow/Focus ring on soft badges and Box Shadow/Focus ring offset on fill badges, where a plain ring would blend into the fill.

Badge renders a native span. The span itself never acts as a button. With onRemove, a label badge contains one native <button type="button"> outside the hidden icon slots. Its accessible name is removeLabel, or Remove {label} built from string or number children, or Remove for other children. Translate both defaults through NesraI18nProvider. The application moves focus to a sensible place after removal. Label text, status text, XP text, and level text are exposed to assistive technology. Decorative icons are hidden. Give an indicator an aria-label when it conveys meaning alone, or aria-hidden="true" when nearby text supplies that meaning. The application owns live announcements for changing status and action behavior for clickable XP prompts.

Prop Type Default Effect
variant "label" | "indicator" | "status" | "course" | "xp" | "level" "label" Selects visual anatomy.
appearance "soft" | "fill" | "outline" By variant Label defaults to soft; status defaults to fill.
color "brand" | "info" | "success" | "warning" | "error" | "neutral" | "purple" "brand" Label color.
size "xs" | "sm" | "md" | 8 | 12 | 16 | 20 By variant Label: md; indicator: 16px; course and XP: xs; level: sm.
indicator "dot" | "check" "dot" Indicator glyph.
status "pending" | "verified" | "canceled" "pending" Status palette and icon.
xpState "default" | "active" | "claimed" "default" XP color and claimed check. Active shares default styling; its text is consumer supplied.
level "easy" | "moderate" | "hard" "easy" Number of highlighted level bars.
children ReactNode — Visible label or text. Not rendered for indicator.
startIcon, endIcon ReactNode — Decorative slots. Course uses startIcon for its logo. Pass startIcon={null} to omit a status icon.
onRemove (event: MouseEvent<HTMLButtonElement>) => void — Label only. Renders a remove button that calls the handler. endIcon becomes its icon.
removeLabel string — Accessible name of the remove button. Overrides the translated default.

Native span attributes, className, and refs are forwarded. badgeVariants returns classes for the label visual axes only. The course example uses a generic spreadsheet icon; applications can pass their licensed Excel or Google Sheets logos through startIcon to match the Figma artwork. Colors come from the Light and Dark semantic color roles; see also shape tokens.