Indicator
A badge wrapper that annotates a child with an optional count and accessible label.
beta
Try it
Inbox 3 3 unread messages
<Indicator label="3 unread messages" count={3}>Inbox</Indicator>Examples
Unread messages
3 3 unread messages
<script lang="ts">
import Indicator from '@tcpsystems/ui/foundation/Indicator';
import Button from '@tcpsystems/ui/foundation/Button';
let count = $state(3);
</script>
<Indicator label={`${count} unread messages`} {count}>
<Button onclick={() => count = 0}>Inbox</Button>
</Indicator>Tones
Queued 2 2 queued deployments New 4 4 new deployments Healthy 8 8 healthy services Expiring 3 3 expiring certificates Failed 1 1 failed deployment Scheduled 6 6 scheduled jobs
<script lang="ts">
import Indicator from '@tcpsystems/ui/foundation/Indicator';
import Cluster from '@tcpsystems/ui/foundation/Cluster';
</script>
<Cluster gap="lg">
<Indicator label="2 queued deployments" count={2} tone="neutral">Queued</Indicator>
<Indicator label="4 new deployments" count={4} tone="accent">New</Indicator>
<Indicator label="8 healthy services" count={8} tone="ok">Healthy</Indicator>
<Indicator label="3 expiring certificates" count={3} tone="warn">Expiring</Indicator>
<Indicator label="1 failed deployment" count={1} tone="danger">Failed</Indicator>
<Indicator label="6 scheduled jobs" count={6} tone="info">Scheduled</Indicator>
</Cluster>Zero and no count
No unread alerts Activity Deployment activity
<script lang="ts">
import Indicator from '@tcpsystems/ui/foundation/Indicator';
import Cluster from '@tcpsystems/ui/foundation/Cluster';
import Button from '@tcpsystems/ui/foundation/Button';
</script>
<Cluster gap="lg">
<Indicator label="No unread alerts" count={0}><Button disabled>Alerts</Button></Indicator>
<Indicator label="Deployment activity"><Button href="/components/status/">Activity</Button></Indicator>
</Cluster>API
import Indicator from '@tcpsystems/ui/foundation/Indicator';| Prop | Type | Default |
|---|---|---|
label | string | none |
count? | number | none |
tone? | 'neutral' | 'accent' | 'ok' | 'warn' | 'danger' | 'info' | none |
| Snippet |
|---|
children |
| Hook | Kind |
|---|---|
.tcp-indicator | Root class |
data-tone | Data attribute |