Menu

Badge

Status labels. 5 colors × 3 styles × 2 sizes.

In stock

Installation

$ npx uix-ui@latest add badge

This copies the file into components/ui/badge.tsx in your project. npx shadcn@latest add @uix/badge works too.

Usage

badge.tsx
import { Badge } from "@/components/ui/badge";

<Badge color="success">In stock</Badge>

Examples

Colours

DraftNewDeliveredPackingCancelled

Appearances

subtleDraftUnpaid
solidDraftUnpaid
outlineDraftUnpaid

Dot, icon and removable

OnlineBestsellerSylhetOrganic

Props

PropTypeDefaultDescription
colorneutral | brand | success | warning | error"neutral"
appearancesubtle | solid | outline"subtle"
sizesm | md"md"
dotbooleanfalseShows a small dot before the label.
leadingIconReact.ReactNode–Icon before the label.
onClose() => void–Shows a close button and calls this when it is pressed.

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
  • components/ui/icons.tsx
esc

↑↓ to navigate · ↵ to select · esc to close