Badge
Displays a badge or a component that looks like a badge.
BadgeSecondaryDestructiveOutline
Installation
pnpm dlx cubix@latest add badge --base radixUsage
import { Badge } from "@/components/cubix/badge"<Badge variant="default | secondary | destructive | outline | ghost | link">
Badge
</Badge>Examples
Variants
Use the variant prop to change the look of the badge.
DefaultSecondaryDestructiveOutlineGhostLink
With Icon
Render an icon inside the badge. Use data-icon="inline-start" and data-icon="inline-end" so padding follows reading direction in LTR and RTL.
DefaultDefault
With Spinner
Render a spinner inside the badge. Add data-icon so padding matches the icon examples.
DeletingGenerating
Custom Colors
Override colors with classes such as bg-green-50 dark:bg-green-950.
BlueGreenSkyPurpleRed
RTL
To enable RTL support, see the Direction guide. Icon padding uses inline-start / inline-end so it stays correct under dir="rtl".
نشانثانویهمخربحاشیهتأیید شدهادامه
API Reference
Note: Put icons and spinners inside the badge and mark them with data-icon so spacing stays correct.
Badge
The control that displays a badge or a component that looks like a badge.
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | "default" | The visual style of the badge. |
| render | React.ReactElement | - | Render the badge as another element, such as a link. On Radix, use asChild instead. |
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
| children | React.ReactNode | - | Badge label, optional icon, or spinner. |