Badge
Inline status labels with semantic color variants, an optional dot indicator, left icon, and three sizes. Built as a <span> for inline use.
Import
tsx
import { Badge } from 'https://git.cameronlow.com/cam/VelocityUI/packages'Preview
Variants
DefaultInfoSuccessWarningDangerPrimary
With dot
ActivePendingOfflineProcessing
Sizes
SmallMediumLarge
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'default' | 'info' | 'success' | 'warning' | 'danger' | 'primary' | 'default' | Color scheme of the badge. |
| size | 'sm' | 'md' | 'lg' | 'md' | Padding and font size. |
| dot | boolean | false | Shows a small colored circle before the label. |
| leftIcon | ReactNode | — | Icon rendered to the left of the text (ignored when dot is true). |
Examples
Variants
tsx
import { Badge } from 'https://git.cameronlow.com/cam/VelocityUI/packages'
export default function Example() {
return (
<div style={{ display: 'flex', gap: '0.5rem', flexWrap: 'wrap' }}>
<Badge variant="default">Default</Badge>
<Badge variant="info">Info</Badge>
<Badge variant="success">Success</Badge>
<Badge variant="warning">Warning</Badge>
<Badge variant="danger">Danger</Badge>
<Badge variant="primary">Primary</Badge>
</div>
)
}With dot
tsx
import { Badge } from 'https://git.cameronlow.com/cam/VelocityUI/packages'
export default function Example() {
return (
<div style={{ display: 'flex', gap: '0.5rem' }}>
<Badge variant="success" dot>Active</Badge>
<Badge variant="warning" dot>Pending</Badge>
<Badge variant="danger" dot>Offline</Badge>
</div>
)
}Sizes
tsx
import { Badge } from 'https://git.cameronlow.com/cam/VelocityUI/packages'
export default function Example() {
return (
<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
<Badge size="sm" variant="info">Small</Badge>
<Badge size="md" variant="info">Medium</Badge>
<Badge size="lg" variant="info">Large</Badge>
</div>
)
}Theming
Apply a named theme class to <body> or any parent element. All VelocityUI components inside that element will automatically adopt its colors, shadows, and effects. Combine with a density modifier for complete control:
css
/* Pick any named theme */
<body class="vui-theme-ocean">
/* Add a density modifier (optional) */
<body class="vui-theme-midnight vui-density-compact">
<body class="vui-theme-construction vui-density-spacious">
/* Available themes */
/* default midnight ocean */
/* construction glass soft high-contrast monochrome-red */
/* Available densities */
/* vui-density-compact vui-density-comfortable vui-density-spacious */