Skip to contents

Meter

A graphical display of a numeric value within a range.

Storage Used
x

Anatomy

Import the component and assemble its parts:

Anatomy

API reference

Root

Groups all parts of the meter and provides the value for screen readers. Renders a <div> element.

format Intl.NumberFormatOptions | undefined —
Name
Description

Options to format the value. When omitted, the value is formatted as a percentage of the range.

Type
Intl.NumberFormatOptions | undefined
getAriaValueText function | undefined —
Description

Returns the human-readable text for aria-valuenow. Receives the formatted clamped value and the raw value prop.

Type
((formattedValue: string, value: number) => string) | undefined
locale Intl.LocalesArgument | undefined —
Name
Description

The locale used by Intl.NumberFormat when formatting the value. Defaults to the user's runtime locale.

Type
Intl.LocalesArgument | undefined
max number | undefined 100
Name
Description

The maximum value.

Type
number | undefined
Default
100
min number | undefined 0
Name
Description

The minimum value.

Type
number | undefined
Default
0
value* number —
Name
Description

The current value.

Type
number
render Snippet<[props: HTMLAttributes<HTMLDivElement>, state: MeterRootState, children: Snippet | undefined]> —
Name
Description

Replace the default <div>. Spread props onto the host and render children.

Type
Snippet<[props: HTMLAttributes<HTMLDivElement>, state: MeterRootState, children: Snippet | undefined]>

Track

Contains the meter indicator and represents the entire range of the meter. Renders a <div> element.

render Snippet<[props: HTMLAttributes<HTMLDivElement>, state: MeterTrackState, children: Snippet | undefined]> —
Name
Description

Replace the default <div>. Spread props onto the host and render children.

Type
Snippet<[props: HTMLAttributes<HTMLDivElement>, state: MeterTrackState, children: Snippet | undefined]>

Indicator

Visualizes the position of the value along the range. Renders a <div> element.

render Snippet<[props: HTMLAttributes<HTMLDivElement>, state: MeterIndicatorState, children: Snippet | undefined]> —
Name
Description

Replace the default <div>. Spread props onto the host and render children.

Type
Snippet<[props: HTMLAttributes<HTMLDivElement>, state: MeterIndicatorState, children: Snippet | undefined]>

Value

A text element displaying the current value. Renders a <span> element.

children Snippet<[formattedValue: string, value: number]> —
Description

Custom value text. Receives the formatted clamped value and the raw value. Omit it to render the formatted value.

Type
Snippet<[formattedValue: string, value: number]>
render Snippet<[props: HTMLAttributes<HTMLSpanElement>, state: MeterValueState, children: Snippet | undefined]> —
Name
Description

Replace the default <span>. Spread props onto the host and render children.

Type
Snippet<[props: HTMLAttributes<HTMLSpanElement>, state: MeterValueState, children: Snippet | undefined]>

Label

An accessible label for the meter. Renders a <span> element.

render Snippet<[props: HTMLAttributes<HTMLSpanElement>, state: MeterLabelState, children: Snippet | undefined]> —
Name
Description

Replace the default <span>. Spread props onto the host and render children.

Type
Snippet<[props: HTMLAttributes<HTMLSpanElement>, state: MeterLabelState, children: Snippet | undefined]>