Badge

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

buridan add badge

Component Guide

Use the following to build the Badge component.

from components.ui.badge import badge

Source Code & Dependencies

For manual installation, copy each of the source codes below in their respective locations.

components/core/core.py

components/ui/badge.py

Examples

Variants

Use the variant prop to change the badge's style.

Props used: variant on badge.

DefaultSecondaryDestructiveOutlineGhost

With Icons

Render an icon inside the badge. Add data-icon="inline-start" or data-icon="inline-end" to the icon to position it correctly (adjusts padding automatically).

Props used: data_icon on the icon child.

VerifiedBookmark

With Spinner

Render a spinner inside the badge — same data-icon positioning convention as icons.

Props used: data_icon on the spinner child.

DeletingGenerating

Pass rx.el.a as the badge's child to turn it into a link. badge accepts *children, so any interactive element works.

Props used: none required — pass rx.el.a(...) as a child.

Custom Colors

Override colors by passing extra classes via class_name.

Props used: class_name on badge.

BlueGreenSkyPurpleRed

API Reference

badge

badge("New", variant="secondary")
Prop Type Default
variant Literal["default", "secondary", "destructive", "outline", "ghost", "link"] "default"
class_name str ""

Any other prop accepted by a native <span> is also passed straight through.