Badge
- Stable
- WCAG 2.2 evidence
- RTL
Short status or category label: Tone x Variant x Size, with an optional dot, leading icon and
remove button. The label is text, so the status is never conveyed by colour alone (WCAG 1.4.1); the dot and icon are
decorative (1.1.1). Presentational: renders in React Server Components. The optional remove button is a small
client island (BadgeRemoveButton), with a 24 px pointer target (2.5.8) and a visible keyboard focus ring (2.4.7). Consumer duties: label wording; announce removals that change results (for example "Filter removed") and move focus
after a removal. Use Button or FilterChip for actions and filters.
import { Badge } from "@nexera-ui/react";- 5
- examples
- 8
- props
- 5
- live controls
- 1
- platform
- 11
- WCAG criteria
- 40
- blocks use it
Try every prop. Copy the code.
Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.
import { Badge } from "@nexera-ui/react";
<Badge />Examples 4
The same examples as Storybook, rendered live. Open Code to copy one.
With icon
Figma Show icon (here Icon/LuCircleCheck) and Show dot off. Both are decorative; the label carries the meaning.
import { Badge } from "@nexera-ui/react";
import { LuCircleCheck } from "react-icons/lu";
const sizes = ["sm", "md", "lg"] as const;
export function WithIcon() {
return (
<div className="flex flex-wrap items-center gap-3">
{sizes.map((size) => (
<Badge
key={size}
label="Active"
size={size}
dot={false}
icon={<LuCircleCheck />}
label="Approved"
/>
))}
</div>
);
}
Removable
Figma Removable: onRemove adds a remove button named by removeLabel. The glyph is 12 or 14 px; the pointer target is 24 px. Tab to it to see the focus ring.
import { Badge } from "@nexera-ui/react";
const sizes = ["sm", "md", "lg"] as const;
export function Removable() {
return (
<div className="flex flex-wrap items-center gap-3">
{sizes.map((size) => (
<Badge key={size} label="Active" size={size} tone="neutral" />
))}
</div>
);
}
Long label
Long labels wrap inside a narrow container instead of being truncated (translations can add 30 to 40 %).
import { Badge } from "@nexera-ui/react";
export function LongLabel() {
return (
<div className="flex max-w-48 flex-col items-start gap-3">
<Badge tone="warning" label="Waiting for approval from the regional payroll administrator" />
<Badge
tone="info"
variant="outline"
size="lg"
label="Contract renewal scheduled after the probation review"
/>
</div>
);
}
Right to left
Right-to-left: the dot and icon move to the start (right) and the padding mirrors.
import { fn } from "storybook/test";
import { Badge } from "@nexera-ui/react";
export function RightToLeft() {
return (
<div dir="rtl" lang="ar" className="flex flex-wrap items-center gap-3">
<Badge tone="leave" label="في إجازة" />
<Badge tone="remote" variant="solid" size="md" label="عن بعد" />
<Badge
tone="neutral"
variant="outline"
size="lg"
label="الهندسة"
removeLabel="إزالة الهندسة"
onRemove={fn()}
/>
</div>
);
}
Props 8
Press "Try it" on a card to load that prop into the playground.
8 props shown
label*NexeraReactNodeText of the badge, for example "Active" or "On leave". It carries the meaning, so write the status in words: the colour only supports it (WCAG 1.4.1). Long labels wrap; they are never truncated.
toneNexera"success" | "warning" | "danger" | "info" | "leave" | "remote" | "brand" | "neutral"Colour set. leave and remote are the HR work statuses.
variantNexera"soft" | "solid" | "outline"Emphasis: tinted fill, solid fill, or a 1 px stroke without fill.
sizeNexera"sm" | "md" | "lg"Padding and type: 18, 20 and 28 px tall with a one-line label.
dotNexerabooleanShow the leading dot. Decorative: hidden from assistive technology.
iconNexeraReactNodeIcon before the label. Shown when
provided, 12 px (14 px at lg), in the label colour. Decorative: hidden from assistive technology.
onRemoveNexera() => voidNot set: the badge has no remove button. Shows the remove button and is called when it is activated. Accepts a Server Action. Move focus somewhere sensible after the badge is removed (for example to the next badge or the field).
removeLabelNexerastringOnly with onRemove.
Accessible name of the remove button. Name what is removed, in your locale's word order, for example
"Remove Engineering" (WCAG 2.4.6, 4.1.2).
* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.
Accessible by default.
Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.
WCAG 2.2 evidence
5 direct · 6 supporting- 1.1.1Non-text ContentLevel A · tested directly
- 1.3.1Info and RelationshipsLevel A · tested directly
- 1.4.1Use of ColorLevel A · tested directly
- 1.4.4Resize TextLevel AA · supporting test
- 1.4.10ReflowLevel AA · supporting test
- 1.4.11Non-text ContrastLevel AA · supporting test
- 1.4.12Text SpacingLevel AA · supporting test
- 2.1.1KeyboardLevel A · tested directly
- 2.4.7Focus VisibleLevel AA · supporting test
- 2.5.8Target Size (Minimum)Level AA · supporting test
- 4.1.2Name, Role, ValueLevel A · tested directly
Fits any width.
Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.
Styling hooks
Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.
<Badge className="shadow-sm" />Used in blocks
- Choose a workspaceSign in and account
- Choose a planOnboarding
- Sidebar app shellApp shells and navigation
- Top bar with tabsApp shells and navigation
- Mobile app shellApp shells and navigation
- Page headerApp shells and navigation
- Recruitment funnelDashboards and analytics
- Data tableLists, tables and records
- Bulk actionsLists, tables and records
- Filter barLists, tables and records
- Filters drawerLists, tables and records
- Record details drawerLists, tables and records
- Add a personForms and data entry
- Search with suggestionsForms and data entry
- Terms and consentForms and data entry
- SecuritySettings and preferences
- Team members and rolesSettings and preferences
- Billing and planSettings and preferences
- IntegrationsSettings and preferences
- Helpdesk assistantMessaging and collaboration
- Comment threadMessaging and collaboration
- Leave requestScheduling and calendar
- Leave approvalScheduling and calendar
- Pricing plansCommerce and payments
- Order summaryCommerce and payments
- PayslipCommerce and payments
- Product galleryCommerce and payments
- Reviews and ratingsCommerce and payments
- Order trackingCommerce and payments
- Candidate shortlistWork and projects
- Approvals inboxWork and projects
- Project progressWork and projects
- Office finderMaps and places
- Check in hereMaps and places
- Mood check-inFeedback and surveys
- Success confirmationStates and system messages
- ToastsStates and system messages
- Long-running jobStates and system messages
- Action sheetMobile patterns
- Tab bar appMobile patterns
Related components
- AccordionItemOne collapsible section of an FAQ or settings page.
- AreaChartA stacked area chart: layers piled up over time with the title, range switch, actions and legend of the card.
- AvailabilityRowOne person's availability across a window of the day: an avatar with initials and the name, and a timeline with the busy periods drawn as bars.
- AvatarA person or organisation shown as a photo, initials or an icon.
- AvatarGroupA row of overlapping avatars with a "+N" chip for the rest.
- AvatarLabelAn avatar with a name and an optional subtitle beside it, for a person in a list, a header or a mention.
- BadgeGroupA pill that pairs a small badge with a short message, for an announcement or a status line.
- BadgeOverflowThe "+N" pill that stands in for the badges a row has no room for.