[ Data Display ]

Bubble

A speech-bubble label with a pointer tail and inline tags, for map pins, route legs, chart annotations and timeline callouts. The dark variant inverts with the theme.

2 examplesDark modeAccessible

Import#

import { Bubble, BubbleTag } from 'reusify-ui';

When to use#

  • Labelling a point on a map, route or chart with a short text and a value.
  • Static callouts that are always visible. For hover help, use Tooltip.

Examples#

Light & dark#

BubbleTag defaults to the opposite color of the bubble; variant="muted" is a soft grey.

Change of airportISTSAW1d 2hStopover in KIV 1h 30mTurkish Airlines 3h 45mChange of airportISTSAW1d 2h
<Bubble>
  Change of airport
  <BubbleTag variant="muted">IST</BubbleTag> <FiChevronRight /> <BubbleTag variant="muted">SAW</BubbleTag>
  <BubbleTag>1d 2h</BubbleTag>
</Bubble>
<Bubble variant="dark">Stopover in KIV <BubbleTag>1h 30m</BubbleTag></Bubble>
<Bubble>Turkish Airlines <BubbleTag>3h 45m</BubbleTag></Bubble>
<Bubble variant="dark">
  Change of airport
  <BubbleTag variant="muted">IST</BubbleTag> <FiChevronRight /> <BubbleTag variant="muted">SAW</BubbleTag>
  <BubbleTag>1d 2h</BubbleTag>
</Bubble>

Tail position & size#

tail="bottom" | "top" | "none" and tailAlign="start" | "center" | "end". size="sm" for dense maps.

Departure 08:40Arrival 14:15Gate B12
<Bubble tail="top" tailAlign="start">Departure <BubbleTag>08:40</BubbleTag></Bubble>
<Bubble variant="dark" tailAlign="end">Arrival <BubbleTag>14:15</BubbleTag></Bubble>
<Bubble size="sm" tail="none">Gate B12</Bubble>

Used in designs#

Bubble in real layouts: this design uses it. Open one to try it and copy the code.

API reference#

<Bubble />

Renders a <span>; other props go on it. Wrap it in a <button> to make it clickable.

variant'light'
'light' | 'dark'

Surface or inverted (ink) bubble.

tail'bottom'
'bottom' | 'top' | 'none'

Side of the pointer.

tailAlign'center'
'start' | 'center' | 'end'

Where along that side.

size'md'
'sm' | 'md'

Height and font size.

<BubbleTag />

variant'contrast'
'contrast' | 'muted'

Opposite color of the bubble, or soft grey.

Accessibility#

  • Bubbles are plain text, so everything inside is read in order. Hide decorative separators (like the chevron) with aria-hidden.
  • The tail is drawn with CSS and is not announced.
  • Colors come from the text and surface tokens, so contrast holds in light and dark mode.