Badge

Compact labels for status and metadata.

Installation

Add this item from the registry, or import it from the package after installing Default File UI.

Registry path

itsvigneshv/default-file-ui/badge

Package import

import { Badge } from "@default-file/ui/components/df-badge"

Default

Default badge label.

Badge

Variants

All visual variants.

defaultsecondarydestructiveoutlineghostlink

Sizes

T-shirt sizes from XS to XL. Default is MD.

XSSMMDLGXL

With close

Dismissible chip with a trailing close control.

DesignFilter: ActiveBlocked

With counter

Nested count badge inside the host. Only MD, LG, and XL. XS and SM are too tight to read.

Inbox12Inbox12Inbox12

With dropdown

Badge as an OptionList trigger with a chevron. Panel align is configurable: start, end, or auto (content-aware).

Properties

Compact label for status and metadata. Compose a close control, nested counter, or OptionList dropdown via children and render.

Badge

PropTypeDefaultNotes
variant"default" | "secondary" | "destructive" | "outline" | "ghost" | "link""default"Visual style of the badge.
size"xs" | "sm" | "md" | "lg" | "xl""md"T-shirt height and type size. Nested counter chips are supported on md, lg, and xl only.
renderReactElementHost element to clone badge styles onto. For dropdowns, prefer OptionListTrigger render={<Badge />}.
asChildbooleanLegacy alias for composing onto a child host.
childrenReactNodeLabel and optional trailing content: close button, nested count badge, or chevron.
classNamestringAdditional styles on the badge.
…HTML attributesHTMLAttributes<HTMLElement>Standard element attributes (id, title, aria-*, etc.).

Composition

Patterns built with children or render. Not separate props on Badge.

PropTypeDefaultNotes
Close buttonchildrenPlace a button with an X icon after the label. The button inherits badge color and is keyboard-focusable.
CounterchildrenNest a second Badge for a count chip. Host size must be md, lg, or xl so the inner chip stays readable.
DropdownOptionListTrigger render={<Badge />}OptionListTrigger owns open/close. Pass Badge via render so the chip is the clickable host. Pair with OptionListContent for the menu.

Dropdown panel

Pass these on OptionListContent when the badge opens an option list. Placement is relative to the badge trigger.

PropTypeDefaultNotes
align"start" | "center" | "end" | "auto""start"Horizontal menu alignment. start pins left, end pins right, center centers on the badge, auto picks the best fit from available space (content-aware).
alignOffsetnumber0Extra shift along the alignment axis in pixels.
side"top" | "bottom" | "left" | "right""bottom"Preferred side of the badge for the menu.
sideOffsetnumber4Gap between the badge and the menu.
alignItemWithTriggerbooleanfalseWhen true, menu width matches the badge. When false, the menu sizes to its option content.