HapplyUI

Components

Status Badge

A compact status indicator badge with icon or dot variants and semantic status colors.


Installation

bunx @happlyui/cli@latest add status-badge

Dependencies

npm packages

  • @radix-ui/react-slot

Registry dependencies

These are automatically installed when you add this component.

  • tv
  • polymorphic
  • recursive-clone-children

Usage

import * as StatusBadge from "@/components/ui/status-badge"

<StatusBadge.Root status="completed">
  <StatusBadge.Dot />
  Badge
</StatusBadge.Root>

Examples

Completed

Completed status badge in stroke and light variants, with icon and dot.

Badge
Badge
Badge
Badge
<StatusBadge.Root status="completed">
  <StatusBadge.Icon as={RiCheckboxCircleFill} />
  Badge
</StatusBadge.Root>

Pending

Pending status badge in stroke and light variants, with icon and dot.

Badge
Badge
Badge
Badge
<StatusBadge.Root status="pending">
  <StatusBadge.Icon as={RiAlertFill} />
  Badge
</StatusBadge.Root>

Failed

Failed status badge in stroke and light variants, with icon and dot.

Badge
Badge
Badge
Badge
<StatusBadge.Root status="failed">
  <StatusBadge.Icon as={RiErrorWarningFill} />
  Badge
</StatusBadge.Root>

Disabled

Disabled status badge in stroke and light variants, with icon and dot.

Badge
Badge
Badge
Badge
<StatusBadge.Root status="disabled">
  <StatusBadge.Icon as={RiForbidFill} />
  Badge
</StatusBadge.Root>

AsChild

Renders the badge as a child element (e.g. a button) using Radix Slot.

<StatusBadge.Root asChild>
  <button type="button">
    <StatusBadge.Icon as={RiForbidFill} />
    Badge
  </button>
</StatusBadge.Root>

API Reference

StatusBadge.Root

The main status badge container.

PropTypeDefaultDescription
variant'stroke' | 'light''stroke'The visual variant of the badge
status'completed' | 'pending' | 'failed' | 'disabled''disabled'The semantic status color
asChildbooleanfalseRender as child element using Radix Slot

StatusBadge.Icon

Renders a polymorphic icon inside the badge.

PropTypeDefaultDescription
asReact.ElementType-The icon component to render

StatusBadge.Dot

Renders a small colored dot indicator inside the badge.

PropTypeDefaultDescription

Previous
Skeleton