Badge
A badge is a visual label or indicator used to convey status or highlight content.
The Badge component has been updated with a new variant system, improved typography, adjusted padding, and shape options based on the latest design specifications.
Updated in eds-core/1.31.0
Quick Start
- Installation
npm install @adaptavant/eds-core- Import
import { Badge } from '@adaptavant/eds-core';
Variant
The Badge uses a variant system with both Secondary (light backgrounds) and Primary (solid backgrounds) options.
Primary Variants
Solid backgrounds with white text for strong emphasis.
{/* positivePrimary */}
<Badge variant="positivePrimary">
Success
</Badge>
{/* criticalPrimary */}
<Badge variant="criticalPrimary">
Error
</Badge>
{/* neutralPrimary */}
<Badge variant="neutralPrimary">
Important
</Badge>
{/* cautionPrimary */}
<Badge variant="cautionPrimary">
Alert
</Badge>
Secondary Variants
Light backgrounds with colored text for subtle emphasis.
{/* positiveSecondary */}
<Badge variant="positiveSecondary">
Active
</Badge>
{/* criticalSecondary */}
<Badge variant="criticalSecondary">
Error
</Badge>
{/* neutralSecondary */}
<Badge variant="neutralSecondary">
Draft
</Badge>
{/* cautionSecondary */}
<Badge variant="cautionSecondary">
Warning
</Badge>
Tone (Deprecated)
⚠️ The
toneprop is deprecated and will be removed in a future version. Use the newvariantprop instead.
The Badge is available in four tones, positive is the default.
{/* Deprecated tone prop */}
<Box className="flex gap-2">
<Badge tone="positive">Deprecated positive</Badge>
<Badge tone="critical">Deprecated critical</Badge>
<Badge tone="neutral">Deprecated neutral</Badge>
<Badge tone="caution">Deprecated caution</Badge>
</Box>
{/* New variant prop (recommended) */}
<Box className="flex gap-2">
<Badge variant="positiveSecondary">New positiveSecondary</Badge>
<Badge variant="criticalSecondary">New criticalSecondary</Badge>
<Badge variant="neutralSecondary">New neutralSecondary</Badge>
<Badge variant="cautionSecondary">New cautionSecondary</Badge>
</Box>
Sizes
Customize the size of the Badge via the size prop. Standard is the default.
<Box className="flex items-center gap-2">
{/* Standard */}
<Badge variant="positiveSecondary" size="standard">
Standard
</Badge>
{/* Small */}
<Badge variant="criticalSecondary" size="small">
Small
</Badge>
</Box>
Icon
Add icons to your badges using the iconStart prop for enhanced visual communication.
<Box className="flex items-center gap-2">
{/* Badge with check icon for success states */}
<Badge variant="positiveSecondary" iconStart={CheckIcon}>
Verified
</Badge>
<Badge isRounded variant="positiveSecondary" iconStart={CheckIcon}>
Verified
</Badge>
{/* Badge with alert icon for warnings */}
<Badge size="small" variant="cautionPrimary" iconStart={WarningIcon}>
Warning
</Badge>
<Badge size="small" isRounded variant="cautionPrimary" iconStart={WarningIcon}>
Warning
</Badge>
</Box>
IsRounded
The Badge supports two shape options controlled by the isRounded prop:
- Default (
isRounded={false}): Rounded corners using4pxborder radius for a subtle, modern look - Circular (
isRounded={true}): Fully circular shape usingrounded-fullfor a more prominent appearance
{/* Default rounded corners */}
<Badge variant="positiveSecondary">
Status
</Badge>
{/* Circular shape */}
<Badge variant="criticalPrimary" isRounded={true}>
Check
</Badge>
Style API
Our design system components include style props that allow you to easily customize different parts of each component to match your design needs.
Please refer to the Style API documentation for more insights.
Badge parts
<Badge className="bg-accent-secondary" classNames={{ label: "text-secondary" , iconStart: "text-secondary" }}
iconStart={EmojiIcon}>
Label
</Badge>
| Part | Description |
|---|---|
| label | The text content of the button. |
| iconStart | The icon displayed on the left side of the Badge. |