sc1m/design
ComponentsMeter

Meter

Meter component built on Base UI, styled with sc1m tokens.

StableBase UI

Live preview

Storage used
x

Installation

pnpm dlx shadcn@latest add @sc1m/meter

This also merges the token layer and installs src/lib/cn.ts plus @base-ui/react. For the manual route — prerequisites, components.json, and app-level setup — see Installation.

Usage

import {
  Meter,
  MeterTrack,
  MeterIndicator,
  MeterLabel,
  MeterValue,
} from "@/components/ui/meter";

Composition

Every part is a separate export. Meter owns state; the rest are presentational and must appear in this order.

Meter├── MeterLabel├── MeterValue└── MeterTrack    └── MeterIndicator

Example

The preview above, with its source. This is the demo module verbatim, so the code and the thing it renders cannot drift apart.

Storage used
x
<Meter {...storyArgs} className="w-64">
  <div className="flex items-center justify-between">
    <MeterLabel>Storage used</MeterLabel>
    <MeterValue />
  </div>
  <MeterTrack>
    <MeterIndicator />
  </MeterTrack>
</Meter>

API reference

Each part forwards every prop of its Base UI counterpart; the tables list the ones declared on the part itself. See Base UI's reference for the inherited element props.

Meter

PropTypeDefaultDescription
formatIntl.NumberFormatOptionsOptions to format the value.
getAriaValueText((formattedValue: string, value: number) => string)A function that returns a string value that provides a human-readable text alternative for aria-valuenow, the current value of the meter.
localeIntl.LocalesArgumentThe locale used by Intl.NumberFormat when formatting the value.
maxnumber100The maximum value
minnumber0The minimum value
valuenumberThe current value.

Accessibility

Behaviour, focus management, and ARIA wiring come from Base UI's Meter — see its reference for the full keyboard map.

Design tokens

The component reads semantic tokens only — no raw colour, radius, or duration appears in its source. Override the token, not the component.

TokenApplied to
--accentMeterIndicator
--brand-radius-smMeterTrack, MeterIndicator
--fgMeterLabel
--fg-mutedMeterValue
--surfaceMeterTrack

Source

src/components/ui/meter/meter.tsx — no next/* imports, so it drops into any React 19 + Tailwind v4 app.