element-plus/docs/en-US/component/badge.md
Jeremy f17c8f3a2e
docs(components): [badge] enhancement (#10789)
* docs(components): [badge] enhancement

* Update badge docs per new syntax.
* Reorganize code per readability wise purpose.

* chore: remove component name prefix

Co-authored-by: JeremyWuuuuu <15975785+JeremyWuuuuu@users.noreply.github.com>
2022-11-27 22:35:13 +08:00

2.0 KiB

title lang
Badge en-US

Badge

A number or status mark on buttons and icons.

Basic Usage

Displays the amount of new messages.

:::demo The amount is defined with value which accepts Number or String.

badge/basic

:::

Max Value

You can customize the max value.

:::demo The max value is defined by property max which is a Number. Note that it only works when value is also a Number.

badge/max

:::

Customizations

Displays text content other than numbers.

:::demo When value is a String, it can display customized text.

badge/customize

:::

Red Dot

Use a red dot to mark content that needs to be noticed.

:::demo Use the attribute is-dot. It is a Boolean.

badge/dot

:::

API

Attributes

Name Description Type Default
value display value. ^[string] / ^[number] ''
max maximum value, shows {max}+ when exceeded. Only works if value is a number. ^[number] 99
is-dot if a little dot is displayed. ^[boolean] false
hidden hidden badge. ^[boolean] false
type badge type. ^[enum]'primary' | 'success' | 'warning' | 'danger' | 'info' danger

Slots

Name Description
default customize default content