This documentation is under construction. Pages can be missing or change at any time. Follow it on GitHub.

Skip to content

Meter

A graphical display of a numeric value within a range.

API reference#

Import the components of the family:

use Phem\Ui\Meter;
use function Phem\Ui\{MeterLabel, MeterValue, MeterTrack, MeterIndicator};

Meter#

A graphical display of a value in a range: Base UI Meter.Root. Give an id to label it with its MeterLabel.

The text of the value is the rounded percent (24%). The format options (style, currency, minimumFractionDigits, maximumFractionDigits) and the locale change it, as in Base UI: see ValueFormat. They need the intl extension of PHP.

PropTypeDefault
valuefloat0
minfloat0
maxfloat100
id?stringnull
formatarray[]
locale?stringnull
children?Htmlnull
...attrsarray[]

MeterLabel#

The label of the meter. It names the meter (aria-labelledby).

PropTypeDefault
children?Htmlnull
...restmixed—

MeterValue#

The value of the meter as a text, for example 24%. Its children replace the text.

PropTypeDefault
children?Htmlnull
...restmixed—

MeterIndicator#

The part of the track that shows the value: its width is the percentage of the value.

PropTypeDefault
...restmixed—

MeterTrack#

The bar of the meter: it holds the MeterIndicator.

PropTypeDefault
children?Htmlnull
...restmixed—

The source of the examples: examples/ui/Meter.phem.

Phem
Esc
↑↓ to navigate↵ to openEsc to close