Badge
A pure CSS component
Anatomy
There are 4 different badge anatomies, each requiring specific accessibility attributes.
Text
Text badge do not require additonal attibutes
Text and SVG
svg
tag requires aria-hidden="true"
to hide it from screen readers as the the text already include the necessary information
svg
tag requires class="badge__icon"
SVG
a
tag requires aria-label="Login to your account"
to indicate indicate the action to the user
svg
tag requires aria-hidden="true"
to hide it from screen readers as the the text already include the necessary information
svg
tag requires class="badge__icon"
One caracter
a
tag requires aria-label="Login to your account"
to indicate indicate the action to the user
Modifier
Each badge can be styled with modifiers.
You can mix as many modifiers on the same badge, however you can choose only one choice per modifer
For convenience the default variant name is omited, meaning there is no need to add the default name class
Variant
Set the variant of each badge
Options: neutral(default), accent
Color
Set the color of each badge
Options: base(default), brand, alert
Font Color
Set the font color of each badge
Options: base(default), brand, alert
Size
Set the size of each badge
Options: md(default), sm, lg, xl
Shape
Set the shape of each button
Options: rectangular(default), square, circle
RTL
RTL support for button with icon
Mix
Mix as many modifiers for each badge
Custom (Tailwind)
If you are using Tailwind styling, you can customize each button with Tailwind utilities
Templates
Button components is available in the followng templates
-
Corex template
Default corex templates. It provides the global, semantic and components tokens
-
Modex template
Based on Corex default template, it adds dark and light mode option to the tokens
-
Themex template
Based on the Corex default template, it adds theming capabilities as well as light and dark mode options to the tokens.