Documentation / Display & media
Indicator
A visual marker placed on another element or next to a text. Four variants: dot (a dot), count (a counter capped by maxCount, 99+ beyond it), status (a presence state at the bottom right, ringed by default) and legend (a dot followed by a label, for a legend).
With children, the indicator wraps them in a relative container and positions itself according to placement (nine positions); offset keeps it inside the frame instead of centring it on the corner. The dot is purely visual: when it carries information, back it up with text for screen readers. No hooks, server-compatible.
Examples
Basic dot
Without a variant, a dot sits at the top right of the wrapped element.
import { Button, Indicator } from "@synertech/ui";
const BellIcon = () => (
<svg
className="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth={2}
aria-hidden="true"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M15 17h5l-1.4-1.4A2 2 0 0118 14.2V11a6 6 0 10-12 0v3.2a2 2 0 01-.6 1.4L4 17h5m6 0a3 3 0 11-6 0"
/>
</svg>
);
export function Basic() {
return (
<Indicator color="error">
<Button icon={<BellIcon />} aria-label="Notifications, nouvelles alertes" />
</Indicator>
);
}Counter
variant="count" shows count and caps it beyond maxCount (99 by default).
import { Button, Indicator } from "@synertech/ui";
const BellIcon = () => (
<svg
className="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth={2}
aria-hidden="true"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M15 17h5l-1.4-1.4A2 2 0 0118 14.2V11a6 6 0 10-12 0v3.2a2 2 0 01-.6 1.4L4 17h5m6 0a3 3 0 11-6 0"
/>
</svg>
);
export function Count() {
return (
<div className="flex items-center gap-8">
<Indicator variant="count" count={3}>
<Button icon={<BellIcon />} aria-label="3 notifications" />
</Indicator>
<Indicator variant="count" count={150} maxCount={99} bordered>
<Button icon={<BellIcon />} aria-label="150 notifications" />
</Indicator>
</div>
);
}Presence status
variant="status" sits at the bottom right with a ring; pulse draws the eye.
import { Avatar, Indicator } from "@synertech/ui";
export function Status() {
return (
<div className="flex items-center gap-6">
<Indicator variant="status" color="success" title="En ligne">
<Avatar fallback="CD" alt="Camille Durand" />
</Indicator>
<Indicator variant="status" color="warning" title="Absent">
<Avatar fallback="HM" alt="Hugo Martin" />
</Indicator>
<Indicator variant="status" color="error" pulse title="Ne pas déranger">
<Avatar fallback="LB" alt="Léa Bernard" />
</Indicator>
</div>
);
}Placement
placement picks one of the nine positions; offset keeps the marker inside the frame.
import { Indicator } from "@synertech/ui";
export function Placement() {
return (
<div className="flex items-center gap-8">
<Indicator placement="top-left" color="primary">
<div className="h-16 w-16 rounded-md bg-gray-100 dark:bg-gray-800" />
</Indicator>
<Indicator placement="bottom-center" color="primary">
<div className="h-16 w-16 rounded-md bg-gray-100 dark:bg-gray-800" />
</Indicator>
<Indicator placement="top-right" color="primary" offset>
<div className="h-16 w-16 rounded-md bg-gray-100 dark:bg-gray-800" />
</Indicator>
</div>
);
}Legend
variant="legend" lines up a dot and its label, with no child to wrap.
import { Indicator } from "@synertech/ui";
export function Legend() {
return (
<div className="flex flex-wrap gap-4">
<Indicator variant="legend" color="primary" label="Trafic direct" />
<Indicator variant="legend" color="success" label="Recherche" />
<Indicator variant="legend" color="warning" label="Référents" />
<Indicator variant="legend" color="purple" label="Réseaux sociaux" />
</div>
);
}API reference
Components
import { Indicator } from "@synertech/ui";Props — IndicatorProps
| Prop | Type | Default | Description |
|---|---|---|---|
borderColor |
string |
— | Ring colour of a |
bordered |
boolean |
— | |
children |
ReactNode |
— | |
color |
IndicatorColor |
— | |
count |
number |
— | |
label |
string |
— | |
maxCount |
number |
— | |
offset |
boolean |
— | |
placement |
IndicatorPlacement |
— | |
pulse |
boolean |
— | |
size |
IndicatorSize |
— | |
variant |
IndicatorVariant |
"dot" |
+ 277 inherited native attributes from HTMLAttributes, AriaAttributes, DOMAttributes (className, id, aria-*, event handlers…).
Types
IndicatorColor
Typetype IndicatorColor = | "default"
| "primary"
| "success"
| "warning"
| "error"
| "info"
| "dark"
| "purple"
| "indigo"
| "teal"type IndicatorPlacement = | "top-left"
| "top-center"
| "top-right"
| "center-left"
| "center"
| "center-right"
| "bottom-left"
| "bottom-center"
| "bottom-right"IndicatorSize
Typetype IndicatorSize = "xs" | "sm" | "md" | "lg" | "xl"IndicatorVariant
Typetype IndicatorVariant = "dot" | "count" | "status" | "legend"