Components/DotIndicator

DotIndicator

A status primitive: a colored dot beside text.

VerifiedSince 0.3.9

Usage

Basic

color tints the dot; label or the default slot supplies the text.

Loading demo...

Best Practices

  • Prefer a label: color must never be the only carrier of state.
  • Use ariaLabel alone only when other text in the same row already conveys the meaning.
  • Take colors from --tx-bui-* or --tx-color-* variables; a hardcoded hex won't follow the theme.
  • In a footer aggregate, wrap the slot text in <strong> to emphasize the figure; the dot stays aligned.
  • Use the dot in dense contexts such as table cells and footers; use TxStatusBadge for a standalone status marker.

API Reference

Props

PropTypeDefaultDescription
colorstring'currentColor'Dot color; any CSS color or custom property.
labelstring-Text beside the dot.
sizenumber8Dot diameter in px.
ariaLabelstring-Accessible name when there is no visible text.

Slots

NameDescription
defaultReplaces the text beside the dot.

Overview

  • With a label or the default slot, the text carries the meaning; no role or aria-label is added.
  • With only ariaLabel, it renders as role="img" with that name.
  • With neither, it is decoration and gets aria-hidden="true".
  • The text uses tabular figures, so changing numbers don't shift sideways.

Technologies

  • Source: packages/tuffex/packages/components/src/dot-indicator/.
  • Adapted from Beautiful UI (© 2026 Shane Levine, MIT); upstream's dot is purely visual, and this port adds the three accessibility identities.
查看源码
packages/tuffex/packages/components/src/dot-indicator/index.ts