English
FxBadge
About 441 wordsAbout 1 min
2025-12-22
Used to display numbers or status markers next to buttons or icons.
Attributes
| Parameter | Description | Type | Optional Values | Default |
|---|---|---|---|---|
| value | Display value | string, number | — | — |
| max | Maximum value. If the value exceeds the maximum, it will display {max}+. Requires value to be of type Number | number | — | — |
| is-dot | Small dot | boolean | — | false |
| hidden | Hide the badge | boolean | — | false |
| type | Type | string | primary / success / warning / danger / info | — |
Basic Usage
Displays the number of new messages.
<fx-badge :value="12" class="item">
<fx-button size="small">Comments</fx-button>
</fx-badge>
<fx-badge :value="3" class="item">
<fx-button size="small">Replies</fx-button>
</fx-badge>
<fx-badge :value="1" class="item" type="primary">
<fx-button size="small">Comments</fx-button>
</fx-badge>
<fx-badge :value="2" class="item" type="warning">
<fx-button size="small">Replies</fx-button>
</fx-badge>
<fx-dropdown trigger="click">
<span class="fx-dropdown-link">
Click to View<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<fx-dropdown-menu slot="dropdown">
<fx-dropdown-item class="clearfix">
Comments
<fx-badge class="mark" :value="12" />
</fx-dropdown-item>
<fx-dropdown-item class="clearfix">
Replies
<fx-badge class="mark" :value="3" />
</fx-dropdown-item>
</fx-dropdown-menu>
</fx-dropdown>
<style>
.item {
margin-top: 10px;
margin-right: 40px;
}
</style>Maximum Value
The maximum value can be customized.
<fx-badge :value="200" :max="99" class="item">
<fx-button size="small">Comments</fx-button>
</fx-badge>
<fx-badge :value="100" :max="10" class="item">
<fx-button size="small">Replies</fx-button>
</fx-badge>
<style>
.item {
margin-top: 10px;
margin-right: 40px;
}
</style>Custom Content
Can display custom text content in addition to numbers.
<fx-badge value="new" class="item">
<fx-button size="small">Comments</fx-button>
</fx-badge>
<fx-badge value="hot" class="item">
<fx-button size="small">Replies</fx-button>
</fx-badge>
<style>
.item {
margin-top: 10px;
margin-right: 40px;
}
</style>Dot Badge
Marks content that needs attention with a red dot.
<fx-badge is-dot class="item">Data Query</fx-badge>
<fx-badge is-dot class="item">
<fx-button
class="share-button"
icon="el-icon-share"
type="primary"
></fx-button>
</fx-badge>
<style>
.item {
margin-top: 10px;
margin-right: 40px;
}
</style>