Skip to content

BbIndicator

The anchored marker: a count or a dot pinned to the corner of another element.

import { BbIndicator } from 'bitboss-ui';

On this page

Use it for

Reach for BbIndicator to pin a marker onto another element. An unread count on a bell, a presence dot on an avatar, a New flag on a nav item.

Use something else when

  • BbBadge, when the marker is an inline label that belongs in the text, with clearable when it can be dismissed

Pass Through

Hover or tap a part to outline it. Toggles flip loading, errors and warnings when the component has them — only parts highlight.

Coming from v2

This component is what v2 called BbBadge. The port is mechanical: rename the tag, move content to text and color to variant, drop floating. In CSS, .bb-badge becomes .bb-indicator.

Unread counts

Put the element you are marking in the slot, never the other way round: BbIndicator wraps it and pins text to its top-right corner.

3
3 unread notifications

The indicator is inert. When the marker has to be clickable, put a BbButton in the slot.

Presence dots

dot replaces the bubble's content with a plain filled marker, the right shape for the state of a person or a service.

MV

Marta Villoresi

Online

LB

Lukas Brandt

Away

SM

Sofia Marchetti

In a call

It wins over text rather than combining with it. And a color on its own is not a label: write the state beside it, as the example does.

Placement, color and size

bottom and left combine to move the marker to any of the four corners.

3top right · count
ALbottom left · presence
9large · warning

The bottom suits a presence dot, clear of a face or initials; the top suits a count, clear of a button's label.

Status colors

variant maps the shared status colors: default, success, info, warning, destructive.

Red on a count means "needs attention". If every marker in the app is destructive, none of them is.

Sizes

Sizes run from xs to 2xl, md is the default.

Pick the size from the element you are decorating, not from the text in the bubble. A 56px avatar and a toolbar button do not take the same marker.

Counts that change

Bind the count you already keep and cap it with max: above the threshold the bubble renders ${max}+.

Zero shows, so hide the marker by withholding text altogether: :text="count || undefined". The bubble is a live region and announces the new count on its own, so wrap a control that already has an accessible name.

Custom colors

Register a name in the plugin config for a color that recurs, and it becomes a typed value of variant.

ts
// nuxt.config.ts
export default defineNuxtConfig({
    bitboss: { indicatorVariants: ['brand'] },
});

The library ships no CSS for registered variants. You style .bb-indicator--brand yourself, setting the two custom properties the built-in variants drive.

css
.bb-indicator.bb-indicator--brand {
    --bg: #7c3aed;
    --color: #fff;
}

For a one-off, override the same properties inline: :style="{ '--bg': '#0891b2', '--color': '#fff' }".