Badge
Displays a badge or a component that looks like a badge.
Installation
Command to install the Badge component.
Component Guide
Use the following to build the Badge component.
from components.ui.badge import badgeSource 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.
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.
With Spinner
Render a spinner inside the badge — same data-icon positioning convention as icons.
Props used: data_icon on the spinner child.
Link
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.
API Reference
badge
badge("New", variant="secondary")
Any other prop accepted by a native <span> is also passed straight through.