Indicator
A small dot or pill that decorates another element — unread counts on icons, status dots on avatars, "new" markers on nav items. Wraps any single child without changing its layout.
Pass aria-label (e.g. "3 unread messages") when the indicator conveys information not present elsewhere in the DOM. The wrapped child stays the primary interactive target.
import { Box, Indicator } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Indicator content="3" colorScheme="danger">
<Box padding="3" background="bg.subtle" borderRadius="md">
Inbox
</Box>
</Indicator>
);
}
Dot variant
Section titled “Dot variant”Set dot to drop the content and render a small filled dot — the right fit for “has activity” / online-status decorations on avatars and nav icons.
import { Box, Indicator, Inline } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Inline gap="6" padding="4" background="bg.subtle" borderRadius="md">
<Indicator dot colorScheme="success" placement="bottom-end" aria-label="Online">
<Box padding="3" background="bg.surface" borderRadius="full" width="48px" height="48px" />
</Indicator>
<Indicator dot colorScheme="warning" placement="bottom-end" aria-label="Away">
<Box padding="3" background="bg.surface" borderRadius="full" width="48px" height="48px" />
</Indicator>
<Indicator dot colorScheme="neutral" placement="bottom-end" aria-label="Offline">
<Box padding="3" background="bg.surface" borderRadius="full" width="48px" height="48px" />
</Indicator>
</Inline>
);
}
Colour schemes
Section titled “Colour schemes”colorScheme accepts accent, success, warning, danger, info, neutral. Pair semantics with colour: danger for unread / critical, success for online, warning for attention, accent for new / featured.
import { Box, Indicator, Inline } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Inline gap="5" padding="4" background="bg.subtle" borderRadius="md">
{(['accent', 'success', 'warning', 'danger', 'info', 'neutral'] as const).map((scheme) => (
<Indicator key={scheme} content="3" colorScheme={scheme} aria-label={`${scheme} count`}>
<Box padding="3" background="bg.surface" borderRadius="md">
{scheme}
</Box>
</Indicator>
))}
</Inline>
);
}
Placement
Section titled “Placement”placement accepts top-start, top-end (default), bottom-start, bottom-end. Use offset to nudge the indicator inward when it should sit inside the child rather than spilling over the edge.
import { Box, Indicator, Inline } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Inline gap="5" padding="4" background="bg.subtle" borderRadius="md">
{(['top-start', 'top-end', 'bottom-start', 'bottom-end'] as const).map((placement) => (
<Indicator key={placement} content="•" placement={placement} aria-label={placement}>
<Box padding="3" background="bg.surface" borderRadius="md" width="80px">
{placement}
</Box>
</Indicator>
))}
</Inline>
);
}
Recipes
Section titled “Recipes”- Unread count on an icon button:
<Indicator content={count} colorScheme="danger" hideOn={(c) => !c}><IconButton ... /></Indicator>— thehideOnpredicate keeps the indicator off the DOM when the count is zero. - Avatar online status:
<Indicator dot colorScheme="success" placement="bottom-end"><Avatar ... /></Indicator>. - Always pair counts with an
aria-labeldescribing the meaning so AT users get more than just the number.