HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sortable
  • Spinner
  • Stat
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
Blocks
  • Airtable
  • Airtable Kanban
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Badge

PreviousNext

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

Base UIReact AriaRadix UI
BadgeSecondaryDestructiveOutline
import { Badge } from "@/components/ui/badge"

export function BadgeDemo() {

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/badge.json

Usage#

import { Badge } from "@/components/ui/badge"
<Badge variant="default | outline | secondary | destructive">Badge</Badge>

Variants#

Use the variant prop to change the variant of the badge.

DefaultSecondaryDestructiveOutlineGhost
import { Badge } from "@/components/ui/badge"

export function BadgeVariants() {

Tones and Fill#

Besides destructive, there are success, warning and info variants. Each one comes soft (a pale tint, the default) or solid (the full colour with white text).

<Badge variant="success">Paid</Badge>
<Badge variant="success" fill="solid">Paid</Badge>
<Badge variant="destructive" fill="solid">Overdue</Badge>

With Icon#

You can render an icon inside the badge. Use data-icon="inline-start" to render the icon on the left and data-icon="inline-end" to render the icon on the right.

VerifiedBookmark
import { BookmarkIcon, CheckCircleIcon } from "@phosphor-icons/react"

import { Badge } from "@/components/ui/badge"

With Spinner#

You can render a spinner inside the badge. Remember to add the data-icon="inline-start" or data-icon="inline-end" prop to the spinner.

DeletingGenerating
import { Badge } from "@/components/ui/badge"
import { Spinner } from "@/components/ui/spinner"

Link#

Use the render prop to render a link as a badge.

Open Link
import { ArrowUpRightIcon } from "@phosphor-icons/react"

import { Badge } from "@/components/ui/badge"

Custom Colors#

You can customize the colors of a badge by adding custom classes such as bg-green-50 dark:bg-green-800 to the Badge component.

BlueGreenSkyPurpleRed
import { Badge } from "@/components/ui/badge"

export function BadgeCustomColors() {

RTL#

To enable RTL support, see the RTL configuration guide.

شارةثانويمدمرمخططمتحققإشارة مرجعية
"use client"

import * as React from "react"

API Reference#

Badge#

The Badge component displays a badge or a component that looks like a badge.

PropTypeDefault
variant"default" | "secondary" | "destructive" | "outline" | "ghost" | "link""default"
classNamestring-
Avatar UploadBanner

On This Page

InstallationUsageVariantsTones and FillWith IconWith SpinnerLinkCustom ColorsRTLAPI ReferenceBadge