# Badge
### Intro
Display a small badge or a red dot to the top-right of its child.
### Install
Register component globally via `app.use`, refer to [Component Registration](#/en-US/advanced-usage#zu-jian-zhu-ce) for more registration ways.
```js
import { createApp } from 'vue';
import { Badge } from 'vant';
const app = createApp();
app.use(Badge);
```
## Usage
### Basic Usage
```html
```
### Max
```html
```
### Custom Color
```html
```
### Custom Content
Use `content` slot to custom :content of badge.
```html
```
```css
.badge-icon {
display: block;
font-size: 10px;
line-height: 16px;
}
```
### Standalone
```html
```
## API
### Props
| Attribute | Description | Type | Default |
| --- | --- | --- | --- |
| content | Badge content | _number \| string_ | - |
| color | Background color | _string_ | `#ee0a24` |
| dot | Whether to show dot | _boolean_ | `false` |
| max | Max value,show `{max}+` when exceed,only works when content is number | _number \| string_ | - |
| offset `v3.0.5` | Offset of badge dot | _[number \| string, number \| string]_ | - |
| show-zero `v3.0.10` | Whether to show badge when content is zero | _boolean_ | `true` |
### Slots
| Name | Description |
| ------- | -------------------- |
| default | Default slot |
| content | Custom badge content |
### CSS Variables
The component provides the following CSS variables, which can be used to customize styles. Please refer to [ConfigProvider component](#/en-US/config-provider).
| Name | Default Value | Description |
| --- | --- | --- |
| --van-badge-size | `16px` | - |
| --van-badge-color | `@white` | - |
| --van-badge-padding | `0 3px` | - |
| --van-badge-font-size | `@font-size-sm` | - |
| --van-badge-font-weight | `@font-weight-bold` | - |
| --van-badge-border-width | `@border-width-base` | - |
| --van-badge-background-color | `@red` | - |
| --van-badge-dot-color | `@red` | - |
| --van-badge-dot-size | `8px` | - |
| --van-badge-font-family | `-apple-system-font, Helvetica Neue, Arial, sans-serif` | - |