Skip to content
Nana UI

Feedback & Status

Badge

A small status indicator label with clean, modern design.

View .md Download
New

The badge ships for all three targets. Pick the tab for your project — the CLI detects which you are on and serves the matching implementation.

npx @nana-tec/ui add badge

Lands as src/components/ui/badge/badge.tsx, styled with Tailwind classes that resolve to the design tokens. Requires Tailwind v4.

import { Badge } from "@/components/ui/badge";
export function Example() {
return (
<>
<Badge variant="primary">New</Badge>
<Badge variant="success" dot>Live</Badge>
<Badge variant="neutral" size="sm">Draft</Badge>
</>
);
}

dot prepends a small filled circle in the current colour. Every native <span> attribute passes through, and it forwards a ref.

Classes you pass to the React and Svelte components are merged with tailwind-merge, so an override wins rather than fighting. See Using Tailwind.

Primary Success Warning Danger Info Neutral

The React and Svelte props, read from the components’ own types:

Badge

PropTypeDefault
variantBadgeVariant'neutral'
sizeBadgeSize'md'
dotbooleanfalse
childrenReactNode

Also accepts Omit<HTMLAttributes<HTMLSpanElement>, 'children'>.

The attribute names, events and CSS hooks below are the Web Components reference.

Properties

PropertyAttributeTypeDefaultDescription
capsulecapsulebooleanfalseCapsule shape instead of fully rounded
dotdotbooleanfalseShow a dot indicator before the text
interactiveinteractivebooleanfalseMakes badge interactive with hover/focus states
outlineoutlinebooleanfalseOutline style with transparent background
pulsepulsebooleanfalsePulse animation for the dot (only when dot is true)
removableremovablebooleanfalseRemovable badge with close button
sizesizeBadgeSize'md'Size of the badge
variantvariantBadgeVariant'neutral'Visual style variant

Slots

SlotDescription
(default)Badge text content

CSS parts

PartDescription
::part(badge)The badge container
::part(remove-button)The remove button, when removable

CSS custom properties

PropertyDescription
--nana-badge-bgCustom background color
--nana-badge-colorCustom text color
--nana-badge-borderCustom border color
EventType
removeCustomEvent
SlotDescription
(default)Badge text content
VariableDescription
--nana-badge-bgCustom background color
--nana-badge-colorCustom text color
--nana-badge-borderCustom border color
PartDescription
badgeThe badge label
remove-buttonThe remove button (when removable)
Explore Badge interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook