Count
A notification number / badge that clamps to max (“N+”) with an optional dot
mode for presence indicators.
Import
Section titled “Import”<script> import Count from "@invisible-ui/svelte/Count.svelte";</script><script setup> import { Count } from "@invisible-ui/vue";</script>import { Count } from "@invisible-ui/react";<script type="module"> import "@invisible-ui/elements/define";</script>
<ds-count></ds-count>| Prop | Type | Default | Description |
|---|---|---|---|
count | number | 0 | The value to show. |
max | number | 99 | Clamp threshold (e.g. 128 → 99+). |
dot | boolean | false | Render a dot instead of a number. |
showZero | boolean | false | Render when count is 0. |
status | CountStatus | "danger" | Color. |
label | string | undefined | undefined | Accessible description (e.g. "unread messages"). |
| Prop | Type | Default | Description |
|---|---|---|---|
count | number | 0 | The number to display. |
max | number | 99 | Ceiling before showing "N+". Defaults to 99. |
dot | boolean | false | Render a bare dot (presence indicator) instead of a number. |
showZero | boolean | false | Show the bubble even when count is 0. Defaults to false. |
status | CountStatus | "danger" | Status color. Defaults to danger (the conventional unread red). |
label | string | undefined | Fuller accessible label (e.g. "3 unread messages"). |
| Prop | Type | Default | Description |
|---|---|---|---|
count | number | 0 | The number to display. |
max | number | 99 | Ceiling before showing "N+". Defaults to 99. |
dot | boolean | false | Render a bare dot (a presence indicator) instead of a number. |
showZero | boolean | false | Show the bubble even when count is 0. |
status | CountStatus | "danger" | Status colour. Defaults to danger, the usual unread colour. |
label | string | — | Fuller accessible name, such as "3 unread messages". |
| Attribute | Reactive | Description |
|---|---|---|
count | yes | |
max | yes | |
dot | yes | |
show-zero | yes | |
status | yes | |
label | yes |
Reactive attributes re-render the element when they change after the first render.
Accessibility
Section titled “Accessibility”- Pass
labelso the number is announced with meaning (e.g. “5 unread messages”). - The number reaches 4.5:1 on every status fill. Warning paints
--ds-components-general-feedback-warning-label-background-defaultunder the dark--ds-components-general-feedback-warning-solid-foreground-default, 4.71:1 in both themes.
Example
Section titled “Example”<Count count={128} max={99} label="notifications" /><ds-count count="128" max="99" label="128 notifications"></ds-count>In React:
<Count count={128} max={99} label="128 notifications" />Themeable via --ds-count-*.