Skip to content

Badge

Free

A short label next to content, such as a count, a status, or a plan name. Pick a color for the meaning, and use the link form to go to a page.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Put a BadgeImage in the icon slot of the badge, then the text that names the thing, so the picture can stay decorative.

The sample also uses badge-image. One command adds them with this item:

source-pills.tsx

Badge

<span>
PropTypeDefaultDescription
rounded"default""full""full"
size"default""lg""default"
variant"dashed""default""destructive""ghost""info""link""media""outline""secondary""success""warning""default"
From Base UIUseRenderBase UI docs
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

BadgeImage

<div>
PropTypeDefaultDescription
srcstring | Blob—The file: an address, or a Blob (a File a person dropped, shown through an object URL that is freed with the file). With no src, the box shows the fallback at once and loads nothing.
srcSetstring—A ready srcset for src ("a-640.jpg 640w, a-1280.jpg 1280w"), with sizes: for files that a server already made at each width. It wins over loader and transformer. Change it together with src: the old picture keeps only its src while the new one loads.
sizesstring—The sizes of the srcset: how wide the box is per screen ("(max-width: 640px) 100vw, 33vw").
loaderImageLoader—Makes the URL of each srcset width, Next.js style. Default: the loader of the nearest ImageLoaderProvider (none outside one).
transformerImageTransformer—An Unpic provider transformer, an alternative to loader.
qualitynumber—The quality that loader and transformer get (1–100).
preloadboolean—A picture above the fold (a hero): loads at once with a high fetch priority, and React preloads it (<link rel="preload"> with the srcset). Default false: lazy.
placeholder"none"What shows while the file loads: muted (default, the muted box), skeleton (the box with a shimmer band), blur (blurDataURL, blurred), color (placeholderColor), none (no fill, also on an error: the parent shows), or an element: your own layer under the file until its fade ends (a sharp thumbnail of the same picture).
blurDataURLstring—A tiny copy of the picture (10px or less, a data URL) for placeholder="blur".
placeholderColorstring—The main color of the picture for placeholder="color" (a data color).
positionstring—The CSS object-position of the picture in the box ("top", "30% 60%").
fadebooleanfalseFade the file in when it loads. Default true. A file the page already loaded, or a server file, shows at once.
onLoadingStatusChange—Called with the new status: idle, loading, loaded, error.
onLoad—
onError—
classNamestring—The classes of the box (size, corners, ratio).
imgClassNamestring—The classes of the <img>.
styleCSSProperties—
childrenReactNode—An ImageFallback for the error and the no-src box. Default: an icon (none for alt=""). With a child, the root is not role="img": the fallback speaks for itself, and an img role would hide its words and controls (a retry button) from screen readers.
altstring""Default "": the badge text names the thing.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it for a short status, a count, or a plan name next to content.
  • Put the word in the badge. For a status in green, amber, or blue, use success, warning, or info; for a red one, use destructive; for a neutral one, use secondary. Add a Dot when the status needs a color mark.
  • In table rows, use outline or ghost. A secondary fill almost disappears on a hovered row in light mode.
  • Use size="lg" next to a default 32px Button, and the default size next to an sm Button.
  • To make it a link, pass render={<a href="/changelog" />} or a router link.
  • For an action, use a Button.
  • For a key or a shortcut, use a Kbd.
  • For a color mark with no box, use a Dot.

Badge renders a <span> with no role and no focus stop. A screen reader reads its text with the content around it.

Always give a badge text. An empty badge is a small circle with no name. A status Dot in a badge is hidden from screen readers, so the word carries the status and color is never the only sign.

With render={<a href="…" />}, the badge is a link. It gets a hover fill, a 3px focus ring on keyboard focus, and, on a coarse pointer, a touch target of at least 44 × 44px (hit-area).

For a badge that shows its details, such as a Tooltip with the reason of a status, render the Base UI Button through render, not a raw <button>. Give it an aria-label that says the full status.

BadgeImage is decorative by default (alt=""): the badge text names the thing.

  1. AddedBadge.
Open the release