Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Display

Indicator <pm-indicator>

Count or dot on the corner of an icon, button or avatar: unread notifications, messages, cart items, status.

Full screen
Cart

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/avatar'; import '@prismora/elements/button'; import '@prismora/elements/indicator'; import { registerIcons } from '@prismora/elements/icon'; import { bell, inbox, messageCircle, shoppingCart } from '@prismora/icons'; registerIcons([bell, inbox, messageCircle, shoppingCart]); </script> <pm-indicator count="3" label="{count} unread"> <pm-button variant="ghost" icon icon-start="bell" label="Notifications"></pm-button> </pm-indicator> <pm-indicator count="120" label="{count} messages"> <pm-button variant="ghost" icon icon-start="message-circle" label="Messages"></pm-button> </pm-indicator> <pm-indicator count="2" tone="accent" label="{count} items"> <pm-button variant="soft" icon-start="shopping-cart">Cart</pm-button> </pm-indicator> <pm-indicator dot tone="success" placement="bottom-end" label="Online"> <pm-avatar name="Ada Lovelace"></pm-avatar> </pm-indicator> <pm-indicator dot pulse label="New updates"> <pm-button variant="ghost" icon icon-start="inbox" label="Inbox"></pm-button> </pm-indicator>

Sizes

Set with the size attribute; controls keep touch-sized targets on phones.

size="sm"
size="md"
size="lg"

Tones

Set tone on the element, or data-tone on any ancestor to tone a whole area.

tone="accent"
tone="secondary"
tone="neutral"
tone="success"
tone="warning"
tone="danger"
tone="info"

Overview

Wraps one element. count shows a number (max caps it: 120 → "99+"); dot shows a dot instead. Nothing shows at 0 unless show-zero. The badge is visual; its meaning reaches screen readers as the wrapped control's description, from label ({count} is filled in), e.g. "Notifications, 3 unread". live also announces changes.

Attributes

AttributeTypeDefaultDescription
countnumber—Number to show.
maxnumber99Highest number shown before "+" (default 99; 0 = no cap).
dotbooleanfalseShow a dot instead of a number (with or without count).
show-zero
prop: showZero
booleanfalseKeep showing the badge when count is 0.
placement'top-end' | 'top-start' | 'bottom-end' | 'bottom-start'—Corner: top-end (default), top-start, bottom-end or bottom-start.
labelstring—Screen reader description; {count} is filled in (default "{count} new", or "New" for a dot).
pulsebooleanfalsePulse to draw attention (off when the user prefers reduced motion).
livebooleanfalseAnnounce count changes politely to screen readers.
size'sm' | 'md' | 'lg'—Badge size.
overlap'box' | 'icon' | 'circle'—What the badge sits on: box hangs it off the corner, icon puts it on the corner of the icon inside an icon button (it stays inside the button), circle on the edge of a round avatar. Worked out from the wrapped element when left off.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Slots

SlotDescription
(default)The element to decorate (one).

CSS parts

PartDescription
::part(badge)The count or dot.

Used in templates

Overview dashboardTraffic analyticsOrdersCustomer 360InboxTeam chatAI assistantNotificationsProject boardTeam and rolesBilling and invoicesUser profileAccount settingsProduct pageShopping cartCheckout