The indicator is a small absolute-positioned badge for counts, status dots, and legends.
Setup
<script>
import { Indicator } from '@cailabs/components.base';
</script> Default indicator
<script>
import { Indicator } from '@cailabs/components.base';
</script>
<Indicator color="gray" />
<Indicator color="blue" />
<Indicator color="green" />
<Indicator color="red" /> Sizes and corner style
<Indicator size="xs" />
<Indicator size="sm" />
<Indicator size="md" />
<Indicator size="lg" />
<Indicator size="xl" />
<Indicator cornerStyle="rounded" color="indigo" /> Legend indicator
Visitors Sessions Customers Revenue
<script>
import { Indicator } from '@cailabs/components.base';
</script>
<span class="flex items-center"><Indicator size="sm" color="orange" class="me-1.5" />Visitors</span>
<span class="flex items-center"><Indicator size="sm" color="purple" class="me-1.5" />Sessions</span> Indicator count
Parent needs relative (or use a component that provides it).
<script>
import { Indicator, Button } from '@cailabs/components.base';
</script>
<Button size="lg" class="relative flex gap-1">
Messages
<Indicator color="red" border size="xl" placement="top-right">
<span class="text-xs font-bold text-white">8</span>
</Indicator>
</Button> Placements
placement with offset (default true) nudges the badge outside the corner.
<script>
import { Indicator } from '@cailabs/components.base';
</script>
<div class="relative h-24 w-40 border">
<Indicator color="red" placement="top-right" />
<Indicator color="green" placement="bottom-left" />
</div> Status indicator (Avatar)
Avatar accepts Indicator props via dot.
<script>
import { Avatar } from '@cailabs/components.base';
</script>
<Avatar
src="/images/profile-picture-5.webp"
dot={{ color: 'green', size: 'lg', placement: 'top-right' }}
/> Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | Snippet | — | Optional content (e.g. count) |
color | 'primary' | 'secondary' | 'gray' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'primary' | Background color |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' | Dot / badge size |
cornerStyle | 'rounded' | 'circular' | 'circular' | Shape |
border | boolean | false | Light border |
placement | 'default' | 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | — | Absolute position (parent must be relative) |
offset | boolean | true | Nudge outside the corner when placed |
class | ClassValue | — | Extra classes |
...rest | HTMLAttributes<HTMLDivElement> | — | Root attributes |