Skip to main content

Badge

A small, non-interactive label built on Box, typically used for counts, statuses, or tags. Accepts an optional leading icon: any component matching TVajraIconComponent. The example below uses @88khp/vajra-icons, a small set of Lucide icons pre-adapted to that contract.

Basic usage​

New
3
Beta
<Badge label="New" />
<Badge label="3" bg="error" />
<Badge label="Beta" bg="warning" />

With icon​

Live
import { CircleIcon } from '@88khp/vajra-icons';

<Badge label="Live" icon={CircleIcon} bg="success" />

Props​

Badge accepts all Box props (TUiBoxProps) in addition to:

PropTypeDefaultDescription
labelstringRequired. Badge text.
tone'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info''primary'Background color for the badge. An explicit bg overrides it.
textPropsOmit<TTextProps, 'children'>Extra props forwarded to the internal Text.
iconTVajraIconComponentOptional icon component rendered before the label; receives size and color.
iconSizenumber12Size passed to the icon.
iconColorTVajraColors'textInverse'Color passed to the icon.
roundedTRoundedToken'r-full'Corner radius (inherited from Box).
bgTVajraColorstoneBackground color (inherited from Box). Defaults to the tone color.
pxTSpacingToken's-2'Horizontal padding (inherited from Box).
pyTSpacingToken's-1'Vertical padding (inherited from Box).