Documentation menu
Getting Started
Components
Primitives
- Agent Thinking
- Alert
- Alert Dialog
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Checkbox
- Command
- Command Palette
- Context Menu
- Data Table
- Dialog
- Dropdown Menu
- Empty
- Field
- Glow Cloud
- Input
- Label
- Medication Schedule
- Period Tabs
- Popover
- Rainbow Button
- Scroll Area
- Select
- Selectable Card
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag
- Textarea
- Timeline
- Tooltip
- Use Count Up
Charts and metrics
Patterns
- Confirm Button
- Date Picker
- Embedded
- Empty State
- Entity Drawer
- Error Boundary
- Field Row
- File Dropzone
- Form Dialog
- Kv
- List Editor
- List Page
- Live Time
- Mini Table
- Money
- Note Field
- Note Text
- Page Card
- Page Header
- Page Tabs
- Page Toolbar
- Person Cell
- Picture Field
- Print Card
- Range Switcher
- Row Actions
- Search Input
- Search Select
- Selected Box
- Signature Pad
- Status Badge
- Sub Nav Layout
- Suggest Input
- Tab Icons
- Table Footer
- Theme Accent Picker
- Time Picker
- View All Link
Dashboard cards
Advanced
Device frames
Website widgets
Website screens
Website panels
Advanced
Badge Plus
A badge with more variants, appearances and sizes.
import { Badge } from "@/registry/vcare/ui/reui-badge"
export default function BadgePlusDemo() {
return (
<div className="flex max-w-xl flex-wrap items-center justify-center gap-2">
<Badge>Default</Badge>
<Badge variant="success">Paid</Badge>
<Badge variant="warning">Pending</Badge>
<Badge variant="destructive">Overdue</Badge>
<Badge variant="info">Info</Badge>
<Badge variant="success-light">Light</Badge>
<Badge variant="info-outline" radius="full">Outline pill</Badge>
<Badge size="xs">XS</Badge>
<Badge size="xl">XL</Badge>
</div>
)
}Installation
npx shadcn@latest add @vcare/reui-badgeOr install directly from the URL: https://ui.vcarehms.com/r/reui-badge.json
- Install the dependencies:
npm i @base-ui/react class-variance-authority - Add the registry items it uses: utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/reui-badge.tsx
import { mergeProps } from '@base-ui/react/merge-props';
import { useRender } from '@base-ui/react/use-render';
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '@/registry/vcare/lib/utils';
const badgeVariants = cva(
[
'relative inline-flex shrink-0 items-center justify-center w-fit border border-transparent font-medium whitespace-nowrap outline-none transition-shadow',
'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50',
'[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-3',
],
{
variants: {
variant: {
default: 'bg-primary text-primary-foreground',
outline: 'border-border bg-transparent dark:bg-input/32',
secondary: 'bg-secondary text-secondary-foreground',
info: 'bg-info text-white',
success: 'bg-success text-white',
warning: 'bg-warning text-white',
destructive: 'bg-destructive text-white',
focus: 'bg-focus text-focus-foreground',
invert: 'bg-invert text-invert-foreground',
'primary-light': 'border-primary/10 bg-primary/10 text-primary dark:border-primary/25 dark:bg-primary/15 dark:text-primary',
'warning-light': 'border-warning/15 bg-warning/10 text-warning-foreground dark:border-warning/25 dark:bg-warning/15 dark:text-warning',
'success-light': 'border-success/15 bg-success/10 text-success-foreground dark:border-success/25 dark:bg-success/15 dark:text-success',
'info-light': 'border-info/15 bg-info/10 text-info-foreground dark:border-info/25 dark:bg-info/15 dark:text-info',
'destructive-light':
'border-destructive/15 bg-destructive/10 text-destructive-foreground dark:border-destructive/25 dark:bg-destructive/15 dark:text-destructive',
'invert-light': 'border-invert/15 bg-invert/10 text-foreground dark:border-invert/45 dark:bg-invert/35 dark:text-invert-foreground',
'focus-light': 'border-focus/15 bg-focus/10 text-focus-foreground dark:border-focus/25 dark:bg-focus/15 dark:text-focus',
'primary-outline': 'bg-background border-border text-primary dark:bg-input/30',
'warning-outline': 'bg-background border-border text-warning-foreground dark:bg-input/30',
'success-outline': 'bg-background border-border text-success-foreground dark:bg-input/30',
'info-outline': 'bg-background border-border text-info-foreground dark:bg-input/30',
'destructive-outline': 'bg-background border-border text-destructive-foreground dark:bg-input/30',
'invert-outline': 'bg-background border-border text-invert-foreground dark:bg-input/30',
'focus-outline': 'bg-background border-border text-focus-foreground dark:bg-input/30',
},
size: {
xs: 'px-1 py-0.25 text-[0.6rem] leading-none h-4 min-w-4 gap-1',
sm: 'px-1 py-0.25 text-[0.625rem] leading-none h-4.5 min-w-4.5 gap-1',
default: 'px-1.25 py-0.5 text-xs h-5 min-w-5 gap-1',
lg: 'px-1.5 py-0.5 text-xs h-5.5 min-w-5.5 gap-1',
xl: 'px-2 py-0.75 text-sm h-6 min-w-6 gap-1.5',
},
/** `default`: active style radius. `full`: pill radius. */
radius: {
default: 'rounded-sm',
full: 'rounded-full',
},
},
defaultVariants: {
variant: 'default',
size: 'default',
radius: 'default',
},
},
);
interface BadgeProps extends useRender.ComponentProps<'span'> {
variant?: VariantProps<typeof badgeVariants>['variant'];
size?: VariantProps<typeof badgeVariants>['size'];
radius?: VariantProps<typeof badgeVariants>['radius'];
}
function Badge({ className, variant, size, radius, render, ...props }: BadgeProps) {
const defaultProps = {
'data-slot': 'badge',
className: cn(badgeVariants({ variant, size, radius, className })),
};
return useRender({
defaultTagName: 'span',
render,
props: mergeProps<'span'>(defaultProps, props),
});
}
export { Badge, badgeVariants, type BadgeProps };Usage
import { Badge } from "@/components/ui/reui-badge"Exports
Badge
Dependencies
@base-ui/react@^1.9.0(npm)class-variance-authority@^0.7.1(npm)@vcare/utils(registry)
Raw item: /r/reui-badge.json