Badge
Badges are small indicators which display a small amount of data to categorize, count or communicate status.
Example
Live Editor
Result
Loading...
Variants
Colors
The Badge component is available in 5 different colors: primary
, neutral
, negative
, positive
and warning
.
Live Editor
Result
Loading...
Besides, the component provides customColor
prop to custom the Badge color and accept following values:
- HEX color: #65579A
- RGB color: rgb(25, 128, 56) or rgb(25 128 56)
- HSL color: hsl(290, 100%, 50%) or hsl(290 100% 50%)
And customColor
prop will overwrite color
prop.
Live Editor
Result
Loading...
Fullwidth
You can use allowFullWidth
prop to show more than the default character limit.
Live Editor
Result
Loading...
Icon
All available icons can be found here.
For icon only badge, omit the label
prop.
Live Editor
Result
Loading...
OnClick
You can use onClick
prop to run a function when the component is clicked.
Live Editor
Result
Loading...
Tooltip
You can add a Tooltip
to the icon only badge to provide a missing label
.
Live Editor
Result
Loading...
Size
The badge component is available with 3 sizes: small
(default), medium
and large
.
Live Editor
Result
Loading...
Props
Name | Type | Default |
---|---|---|
label The label of the Badge |
| — |
color Color of the Badge |
| "neutral" |
customColor Custom Color of the Badge with HEX, HSL and RGB value |
| — |
size Size of the Badge |
| "small" |
iconName Please refer to the full list of icons here: Link | "AddValue" | "AppGrid" | "ArrowCircleLeft" | "ArrowCircleRight" | "ArrowDown" | "ArrowDownLeft" | "A... | — |
allowFullWidth A boolean prop for the badge component to have flexible width |
| — |
onClick onClick function to handle clicks |
| — |
onMouseEnter Native HTML attribute: Link |
| — |
onMouseLeave Native HTML attribute: Link |
| — |
aria-label Provide at least one label(visual or non-visual) property for better accessibility. Check Accessibility page for more info: Link |
| — |
aria-labelledby Provide at least one label(visual or non-visual) property for better accessibility. Check Accessibility page for more info: Link |
| — |
css Add custom styles to this component. Use with caution. Learn more here: Link |
| — |
inputFieldCss |
| — |
data-{foo} Data attributes can be used by testing libraries to retrieve components or assert their existence |
| — |
* - the prop is required. |