Meter

Displays a numeric value within a known range.

Installation

pnpm add @notion-kit/ui

Anatomy

Use MeterBar for linear progress and MeterRing for compact circular progress. Add MeterLabel and MeterValue when the value needs to be announced or displayed inside the meter root.

API Reference

Meter

Meter extends the Base UI Meter root and renders a <div>.

PropTypeDefaultDescription
valuenumber-The current value.
minnumber0The minimum value.
maxnumber100The maximum value.
formatIntl.NumberFormatOptions-Options used to format the value.
localeIntl.LocalesArgumentruntime localeLocale used by Intl.NumberFormat when formatting the value.
aria-valuetextReact.AriaAttributes["aria-valuetext"]-Human-readable text for the current value.
getAriaValueText(formattedValue: string, value: number) => string-Returns the human-readable text alternative for the current value.

MeterBar

MeterBar extends Meter and renders a horizontal track with an indicator.

PropTypeDefaultDescription
trackColorstring-CSS color for the indicator.

MeterRing

MeterRing extends Meter and renders a circular SVG indicator.

PropTypeDefaultDescription
maxnumber100The maximum value.
trackColorstring-CSS color for the indicator.

MeterLabel

MeterLabel extends the Base UI Meter label and renders a <span>.

MeterValue

MeterValue extends the Base UI Meter value and renders a <span>.

PropTypeDefaultDescription
childrennull | ((formattedValue: string, value: number) => ReactNode)-Custom render function for value.