Reflex Logo
Docs Logo
Library

/

Data Display

/

Badge

Badges are used to highlight an item's status for quick recognition.

To create a badge component with only text inside, pass the text as an argument.

New

The size prop controls the size and padding of a badge. It can take values of "1" | "2", with default being "1".

NewNewNew

The variant prop controls the visual style of the badge. The supported variant types are "solid" | "soft" | "surface" | "outline". The variant default is "soft".

NewNewNewNewNew

The color_scheme prop sets a specific color, ignoring the global theme.

NewNewNewNew

The high_contrast prop increases color contrast of the fallback text with the background.

NewNewNewNew
NewNewNewNew

The radius prop sets specific radius value, ignoring the global theme. It can take values "none" | "small" | "medium" | "large" | "full".

NewNewNewNewNew

A badge may contain more complex elements within it. This example uses a flex component to align an icon and the text correctly, using the gap prop to ensure a comfortable spacing between the two.

8.8%

API Reference

rx.badge

A stylized badge element.

Basic Badge
PropType | ValuesDefaultInteractive
access_key
str
-
auto_capitalize
"off" | "none" | ...
-
content_editable
Union["inherit" | "plaintext-only", bool]
-
context_menu
str
-
dir
str
-
draggable
bool
-
enter_key_hint
"enter" | "done" | ...
-
hidden
bool
-
input_mode
"none" | "text" | ...
-
item_prop
str
-
lang
str
-
role
"alert" | "alertdialog" | ...
-
slot
str
-
spell_check
bool
-
tab_index
int
-
title
str
-
variant
"solid" | "soft" | ...
-
size
"1" | "2" | ...
-
color_scheme
"tomato" | "red" | ...
-
high_contrast
bool
-
radius
"none" | "small" | ...
-

Built with Reflex