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 @devraj-labs/vajra-ui-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 '@devraj-labs/vajra-ui-icons';

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

Props

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

PropTypeDefaultDescription
labelstringRequired. Badge text.
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).
bgTVajraColors'primary'Background color (inherited from Box).
pxTSpacingToken's-2'Horizontal padding (inherited from Box).
pyTSpacingToken's-1'Vertical padding (inherited from Box).