Skip to main content
  1. Docs
  2. Components
  3. Data display

Badge

A short, static status or count: one or two words. The word carries the meaning, the tone reinforces it.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<span>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

badge.tsx
// From the package: a build keeps only what it uses.
import { Badge } from "@qeetrix/react";

// Or from its own path.
import { Badge } from "@qeetrix/react/badge";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
tone"neutral" | "brand" | "info" | "success" | "warning" | "danger""neutral"Reinforces the word.
variant"subtle" | "solid""subtle"Subtle, the tone's tint; solid, its bold fill, AA in every tone and scheme.
size"md" | "sm""md"20px or 16px.
iconIconSource—A leading 12px icon (--qx-size-icon-2xs), sharp, decorative.
childrenReactNode—The word or the count.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
badge<span>data-tone, data-variant, data-size.
badge-icon<svg>aria-hidden.
badge-label<span>The text, truncated.

04

From a status

Map each status to its tone once, so every list agrees.

status.ts
const tone = { Active: "success", Invited: "info", Blocked: "danger" } as const;

<Badge tone={tone[user.status]}>{user.status}</Badge>
Next — BadgeAccessibility