Add the class name `badge` to your span or other element.
All CSS variables are prefixed with `--badge-`
by Jane Ori
GitHub
NPM
Specify the color variant of the badge.
Default: default
examples:
--badge-color: default;
CSS Badge
--badge-color: primary;
CSS Badge
--badge-color: secondary;
CSS Badge
--badge-color: info;
CSS Badge
--badge-color: success;
CSS Badge
--badge-color: warn;
CSS Badge
--badge-color: error;
CSS Badge
Default: md
example:
--badge-size: lg;
Default: var(--badge-size, md)
CSS Badge CSS Badge CSS Badge CSS Badge CSS Badge
A scalar value that (typically) reduces the top and bottom padding relative to the left and right padding.
Default: 0.25
example:
--badge-pad-block: 1;
Default: var(--badge-size, md)
CSS Badge CSS Badge CSS Badge CSS Badge CSS Badge
Default: none
example:
--badge-icon: url(https://picsum.photos/200);
Default: none
example:
--badge-icon-color: rebeccapurple;
Default: rounded
example:
--badge-icon-color: rebeccapurple;
--badge-icon-shape: circle;
example
--badge-icon: url(https://picsum.photos/64);
--badge-icon-shape: square;
Default: left
example:
--badge-icon-color: rebeccapurple;
--badge-icon-position: top;
example
--badge-icon: url(https://picsum.photos/64);
--badge-icon-position: bottom;
--badge-icon-shape: circle;
example
--badge-icon: url(https://picsum.photos/64);
--badge-icon-position: right;
--badge-icon-shape: circle;
Here are the color variant properties and their defaults, which are largely copied from bootstrap's default colors:
CSS Badge
--badge-color-default: black;
--badge-background-default: rgb(222, 222, 222);
CSS Badge
--badge-color-primary: white;
--badge-background-primary: rgb(13, 110, 253);
CSS Badge
--badge-color-secondary: white;
--badge-background-secondary: rgb(108, 117, 125);
CSS Badge
--badge-color-info: black;
--badge-background-info: rgb(13, 202, 240);
CSS Badge
--badge-color-success: white;
--badge-background-success: rgb(25, 135, 84);
CSS Badge
--badge-color-warn: black;
--badge-background-warn: rgb(255, 193, 7);
CSS Badge
--badge-color-error: white;
--badge-background-error: rgb(220, 53, 69);
You can override these for an individual instance, set them with a `.badge { ... }` rule globally, or override them in groups with any other selector targeting groups of .badge components.
Here are the sized properties and their defaults:
--badge-pad-xs: 4px;
--badge-pad-sm: 8px;
--badge-pad-md: 12px;
--badge-pad-lg: 16px;
--badge-pad-xl: 20px;
--badge-font-xs: 0.75rem;
--badge-font-sm: 0.875rem;
--badge-font-md: 1rem;
--badge-font-lg: 1.125rem;
--badge-font-xl: 1.25rem;
You can override these for an individual instance, set them with a `.badge { ... }` rule globally, or override them in groups with any other selector targeting groups of .badge components.
This is just CSS so override other settings with standard CSS properties.
example:
opacity: 0.75;
font-family: monospace;
border: 1px solid black;