Skip to content

Badge

A short label next to other content: a status, a counter, a tag.

variant takes a theme color (primary secondary success danger warning info dark light) or one of Tabler’s colors: blue azure indigo purple pink red orange yellow lime green teal cyan, filled with text-bg-{variant}:

white is a white badge with dark text (text-bg-white), for a dark or colored background. It is solid only: with light the badge gets no color class, with outline only badge-outline, since a white tint or a white border is unreadable on a light page.

light uses a tinted background with colored text (bg-{variant}-lt) instead of a filled one:

outline keeps the background transparent and draws a border in the variant color (badge-outline text-{variant}):

pill fully rounds the corners, for counters:

size is sm, md (the default) or lg.

dot renders a small dot with no text (badge-dot), as a status marker. Give it an aria-label:

notification places the badge over the top end corner of its parent (badge-notification); the parent needs position-relative. blink makes it pulse (badge-blink), for a live counter:

icon adds an icon before the label, rendered with Icon (so a prefixed lucide:… name works with symfony/ux-icons) and Tabler’s icon class, hidden from assistive technology. The icon block replaces it. With iconOnly, the badge needs no children: give it an aria-label.

iconOnly makes a square badge that holds only an icon (badge-icononly), from the icon prop or the children:

tooltip sets the title and data-bs-toggle="tooltip" on the badge itself, which tabler.js turns into a Bootstrap tooltip. Unlike a Tooltip, it adds no wrapper, so the badge stays a direct child of a button group or an input group. A dot or iconOnly badge, which has no text, also gets it as its aria-label. Attributes you pass yourself (title, data-bs-toggle, aria-label) win over the generated ones:

Badge:List spaces several badges in a row and wraps them on narrow screens (badge-list):

Its items renders a badge for each entry, an array of Badge props: text (the label, escaped), and the optional variant, icon, light, outline, pill, size, href and tooltip:

With href, the badge renders as an <a>:

Prop Type Default Description
variant string 'primary' primary secondary success danger warning info dark light, a Tabler color blue azure indigo purple pink red orange yellow lime green teal cyan, or white (solid only)
light bool false Tinted background (bg-{variant}-lt) instead of text-bg-{variant}
outline bool false Transparent background and a colored border (badge-outline text-{variant}); takes precedence over light
pill bool false Fully rounded corners (badge-pill)
size string 'md' sm md lg
dot bool false Small dot with no text (badge-dot)
iconOnly bool false Square badge holding only an icon (badge-icononly)
notification bool false Over the top end corner of its parent (badge-notification)
blink bool false Pulsing animation (badge-blink)
href string? null Renders an <a href> instead of a <span>
icon string? null Leading icon name, rendered with Icon (icon)
tooltip string? null Tooltip text (title, data-bs-toggle="tooltip"); the aria-label of a dot or iconOnly badge

Other attributes go to the root <span class="badge"> (or <a>), and win over the generated title, data-bs-toggle and aria-label. Any other variant value renders no color class.

Badge:List:

Prop Type Default Description
items array? null Badges to render: {text, variant?, icon?, light?, outline?, pill?, size?, href?, tooltip?}, Badge props
Component Renders
Badge:List <div class="badge-list">: a wrapping row of badges
Block Default
icon A Tabler:Icon named icon with the icon class, when set
content Empty: the children, the label

The content block of Badge:List renders a Badge for each entry of items; the children replace it.