Usage
Default light badge
Dot badge
Outline badge
Filled badge
Colors
Badge supports all colors from theme.colors. Note that not all colors in some variants are compatible with dark theme:
dark
gray
red
pink
grape
violet
indigo
blue
cyan
teal
green
lime
yellow
orange
dark
gray
red
pink
grape
violet
indigo
blue
cyan
teal
green
lime
yellow
orange
dark
gray
red
pink
grape
violet
indigo
blue
cyan
teal
green
lime
yellow
orange
dark
gray
red
pink
grape
violet
indigo
blue
cyan
teal
green
lime
yellow
orange
Gradient variant
To use gradient as Badge background:
- set
variant
togradient
- set
gradient
to{ from: 'color-from', to: 'color-to', deg: 135 }
, wherecolor-from
andcolor-to
are color fromtheme.colors
deg
is linear gradient deg
Indigo cyan
Lime green
Teal blue
Orange red
Grape pink
Size and radius
Control badge font-size, height and padding with size
and border-radius with radius
.
Both props have predefined values: xs, sm, md, lg, xl.
Alternatively, use a number to set radius in px:
Predefined sizes from xs to xl:
xs size
sm size
md size
lg size
xl size
Theme radius from xs to xl:
xs radius
sm radius
md radius
lg radius
xl radius
Full width and overflow
Badge will take full width of container if fullWidth
prop is true
.
If badge cannot fit in its container, overflow content will be hidden with ellipsis:
Full width badge
Badge with overflow
Right and left sections
Badge with Avatar
Badge with right section
Badge with left section
Custom component
To change badge root element pass React element to component
prop:
Link badge
$$$ Get lots of money $$$
To use custom component with TypeScript provide type:
Feedback
Your feedback is most valuable contribution to the project, please share how you use Mantine, what features are missing and what is done good
Leave feedback