Skip to content
On this page

Badge

Introduce

Badge normally appears in the upper right corner of the icon or text to prompt important information.

Basic usage

Badge use error theme color by default. You only need to set the value attribute to display the corresponding badge.

Custom color

We have o variant to handle contextual colors.

Badge can also be used as a dot. You can set dot attribute to display a dot. And it has the highest priority.

Values

Badge can display a number or a string. If the value is greater than 99, it will be displayed as 99+. Or you can set max attribute to change the maximum value.

If the value is 0, it will not be displayed. You can set showZero attribute to display 0.

Badge Props

NameTypeDefaultDescription
valuestring | numberundefinedDisplay badge content.
maxnumber99Greater than ${max}, display ${max}+.
dotbooleanfalseOnly a dot style.
showZerobooleanfalseWhether to display the number 0.

Badge Slots

NameParametersDescription
default()Badge's content.

MIT Licensed