Meter
A graphical display of a numeric value within a range.
The Stencil example uses the built-in Base UI theme; no CSS import is required.
Set data-fs-theme="base-ui" on an ancestor to apply it without component classes.
Label and Value expose ::part(label) and ::part(value) for custom text styling;
CSS variables control the theme’s colors, typography, size, and spacing.
Root keeps the meter role and layout on its public host, with its assistive text inside
Shadow DOM. Track and Indicator keep their layout hosts so percentage widths, inherited
track height, and width transitions continue to work. Consumer slot content remains public.
Anatomy
Import the component and assemble its parts:
API reference
Root
Groups all parts of the meter and provides the value for screen readers.
Renders a <div> element.
value*number—
- Name
- Description
The current value.
- Type
aria-valuetextstring—
- Name
- Description
A string value that provides a user-friendly name for
aria-valuenow, the current value of the meter.- Type
getAriaValueTextfunction—
- Name
- Description
A function that returns a string value that provides a human-readable text alternative for
aria-valuenow, the current value of the meter.- Type
localeIntl.LocalesArgument—
- Name
- Description
The locale used by
Intl.NumberFormatwhen formatting the value. Defaults to the user’s runtime locale.- Type
minnumber0
- Name
- Description
The minimum value
- Type
- Default
0
maxnumber100
- Name
- Description
The maximum value
- Type
- Default
100
formatIntl.NumberFormatOptions—
- Name
- Description
Options to format the value.
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
Meter.Root.StateHide
Track
Contains the meter indicator and represents the entire range of the meter.
Renders a <div> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
Meter.Track.StateHide
Indicator
Visualizes the position of the value along the range.
Renders a <div> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
Meter.Indicator.StateHide
Value
A text element displaying the current value.
Renders a <span> element.
children| ((formattedValue: string, value: number) => React.ReactNode)
| null—
| null
- Name
- Type
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type
Meter.Value.StateHide
Label
An accessible label for the meter.
Renders a <span> element.
classNamestring | function—
- Name
- Description
CSS class applied to the element, or a function that returns a class based on the component’s state.
- Type
styleReact.CSSProperties | function—
- Name
- Description
Style applied to the element, or a function that returns a style object based on the component’s state.
- Type
renderReactElement | function—
- Name
- Description
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.
Accepts a
ReactElementor a function that returns the element to render.- Type