Badge

Displays a badge or a component that looks like a badge.

Overview

The Badge component displays small status indicators, labels, or counts with support for different variants and appearances. It can be used polymorphically with the render prop for flexible implementations.

Usage

import { Badge } from "@tilt-legal/cubitt-components/primitives";
<Badge variant="brand">Badge</Badge>

Examples

Variants and Appearances

Display badges with different variants in both default and ghost appearances.

Disabled

Display badges in a disabled state across all variants and appearances.

Sizes

Badges come in four sizes: xs, sm, md (default), and lg.

With Icons

Combine badges with icons for enhanced meaning across all variants and appearances.

With Dot

Use the BadgeDot component to add status indicators across all variants and appearances.

Dismissible

Add a BadgeButton to make badges dismissible across all variants and appearances.

Use the render prop to make another component look like a badge.


API Reference

Badge

The root badge component. Extends all HTML span element props.

PropTypeDefaultDescription
variant"brand" | "secondary" | "info" | "success" | "accent" | "caution" | "warning" | "destructive""brand"The semantic variant of the badge
appearance"default" | "outline" | "ghost""default"The visual appearance style
size"xs" | "sm" | "md" | "lg""md"The size of the badge
disabledbooleanfalseWhether the badge is disabled (applies opacity and pointer-events)
renderReactElement-Custom element to render as the badge
dotClassNamestring-Additional CSS classes for dot elements
classNamestring-Additional CSS classes to apply to the badge

BadgeDot

A small colored dot indicator, typically used to show status. Extends all HTML span element props.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the dot

The component renders a span with data-slot="badge-dot" and accepts all standard HTML span attributes.

BadgeButton

A button element for dismissible badges. Extends all HTML button element props.

PropTypeDefaultDescription
variant"default""default"The button variant (currently only default)
renderReactElement-Custom element to render as the button
childrenReact.ReactNode-Button content (typically an X icon)
classNamestring-Additional CSS classes for the button

The component renders with role="button" and data-slot="badge-button".

On this page