Components
BaseBadgeIconButton
An icon button with a counter badge, as used by the notifications and cart buttons of the navbar.
components/ui/BaseBadgeIconButton.vue
View in the demo
Example
Press the first bell to clear it and +1 to add a notification. The badge hides when the count is zero.
4
4
3
API
It also accepts every prop, slot and event of v-icon-btn, which it passes through.
Props
Name | Type | Default | Description |
|---|---|---|---|
iconrequired | string | — | The icon of the button. |
content | string | number | — | The number or text in the badge. The badge hides when it is empty or 0. |
badge-color | string | "primary" | The theme colour of the badge. |
animation | "none" | "ring" | "none" | ring shakes the icon like a bell while there is content; none keeps it still. |
Accessibility
Include the count in the aria-label when it matters, for example “Notifications, 4 unread”, because the badge itself is decorative.