Skip to content
bitboss-ui3.0.0-beta.64

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
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.

Passthrough

Hover or tap a part to outline it. The toggles turn on loading, errors and warnings where the component has them; only parts get a row.

3

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.

Vantera23Marta Villoresi (online)
3 unread notifications

text also takes a short string such as New; keep it to a word or two, and use xs or sm so it fits.

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 colour on its own is not a label: write the state beside it, as the example does.

Placement, colour and size

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

corner
3

top right

3

top left

3

bottom right

3

bottom left

variant
12

default

12

success

12

info

12

destructive

dot
AL

default

AL

success

AL

info

AL

warning

AL

destructive

size
AL

xs

AL

sm

AL

md

AL

lg

AL

xl

AL

2xl

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

Status colours

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. warning suits a dot rather than a count: white digits on amber are too faint to read at bubble size.

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 colours

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

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

The library ships no CSS for registered variants. You style .bb-indicator--mention yourself, setting the two custom properties the built-in variants drive. Mix them from theme tokens, so the bubble follows dark mode.

css
.bb-indicator.bb-indicator--mention {
    --bg: color-mix(in oklab, var(--bb-info) 80%, var(--bb-primary));
    --fg: var(--bb-primary-fg);
}

Past colour, --bw with --border-color rings the bubble so it separates from a busy anchor, --fs sizes the count, and --px widens the pill as the count grows. --offset sets how far the bubble overhangs the corner ([--offset:0px] on class tucks it in), and pt:bubble="ring-2 ring-(--bb-panel)" lifts it off a busy button.

For a one-off, such as a colour that comes from data, override the same properties inline: :style="{ '--bg': team.color, '--fg': team.textColor }". With a colour of your own, check the contrast yourself.