Back to Shark UI

Badge

docs/components/badge

latest6.5 KB
Original Source

Sections

Components

Utilities

Forms

Hooks

Badge

Copy Markdown

A badge or an element styled as a badge.

PreviewCode

Favorite

Installation#

CLIManual

pnpmbunnpmyarn

pnpm dlx shadcn@latest add @shark/badge

Usage#

import { Badge } from "@/components/ui/badge";
<Badge>Favorite</Badge>

Variants#

Default#

PreviewCode

Badge

Secondary#

PreviewCode

Badge

Outline#

PreviewCode

Badge

Success#

PreviewCode

Badge

Info#

PreviewCode

Badge

Warning#

PreviewCode

Badge

Destructive#

PreviewCode

Badge

Sizes#

The size prop controls the badge dimensions.

Small#

PreviewCode

Badge

Medium#

PreviewCode

Badge

Large#

PreviewCode

Badge

Pill#

The pill prop creates fully rounded badges.

PreviewCode

Badge

Examples#

The asChild prop renders another element with badge styling.

PreviewCode

New components

With icon#

PreviewCode

Favorite

With spinner#

PreviewCode

DeletingGenerating

Custom color#

PreviewCode

IndigoPinkSkyPurple

API Reference#

Badge#

Label, count, or status badge. Supports variants.

PropTypeDefault
variant`"default""secondary"
size`"sm""md"
classNamestring-
asChildbooleanfalse

[

Previous page

Avatar ](/docs/components/avatar)[

Next page

Bottom Navigation ](/docs/components/bottom-navigation)

On This Page

InstallationUsageVariantsDefaultSecondaryOutlineSuccessInfoWarningDestructiveSizesSmallMediumLargePillExamplesWith linkWith iconWith spinnerCustom colorAPI ReferenceBadge