Meter
Displays a scalar measurement within a known range and semantic low, high, and optimum bands.
Loading interactive demo…
meter(70.0, 0.0, 100.0).w(240.0).h(8.0)#Import
Import meter from quickgui.
use quickgui::*;#Usage
meter(70.0, 0.0, 100.0).w(240.0).h(8.0)#Anatomy
meter::rootmeter::trackmeter::indicatormeter::labelmeter::value
#API reference
Expand an entry for its description and complete signature. A dash means no declaration default is documented.
Meter
View sourcepub fn new(value: f64, minimum: f64, maximum: f64) -> SelfCreate a meter. Non-finite bounds fall back to `0.0..=1.0` and an inverted range is swapped.
lowpub fn low(mut self, low: f64) -> Self—
Mark the upper end of the low range. Values outside the meter bounds are clamped.
pub fn low(mut self, low: f64) -> SelfView sourcehighpub fn high(mut self, high: f64) -> Self—
optimumpub fn optimum(mut self, optimum: f64) -> Self—
Mark the most favorable value inside the range.
pub fn optimum(mut self, optimum: f64) -> SelfView sourceidpub fn id(mut self, id: impl Into<ElementId>) -> Self—
Give this meter a stable identity so its label and value parts can be related to it.
pub fn id(mut self, id: impl Into<ElementId>) -> SelfView sourceformatpub fn format(mut self, format: ValueFormat) -> Self—
Attach a bounded value formatter, Base UI's `format` prop.
pub fn format(mut self, format: ValueFormat) -> SelfView sourcevalue_textpub fn value_text(mut self, text: impl Into<Arc<str>>) -> Self—
Attach a human-readable value that assistive technology prefers over the raw number. This is Base UI's `getAriaValueText`; an empty string clears it. It wins over [`Self::format`].
pub fn value_text(mut self, text: impl Into<Arc<str>>) -> SelfView sourcedisplay_valuepub fn display_value(&self) -> Option<Arc<str>>—
The formatted text for a caller-owned value part.
pub fn display_value(&self) -> Option<Arc<str>>View sourceaccessible_valuepub fn accessible_value(&self) -> Option<Arc<str>>—
The text assistive technology reads for the value, if any.
pub fn accessible_value(&self) -> Option<Arc<str>>View sourcelabel_idpub fn label_id(&self) -> Option<ElementId>—
Stable identity of the label part, when this meter declares one.
pub fn label_id(&self) -> Option<ElementId>View sourcevalue_idpub fn value_id(&self) -> Option<ElementId>—
Stable identity of the value part, when this meter declares one.
pub fn value_id(&self) -> Option<ElementId>View sourcetrack_idpub fn track_id(&self) -> Option<ElementId>—
Stable identity of the track part, when this meter declares one.
pub fn track_id(&self) -> Option<ElementId>View sourceindicator_idpub fn indicator_id(&self) -> Option<ElementId>—
Stable identity of the indicator part, when this meter declares one.
pub fn indicator_id(&self) -> Option<ElementId>View sourcecurrent_valuepub const fn current_value(&self) -> f64—
minimumpub const fn minimum(&self) -> f64—
maximumpub const fn maximum(&self) -> f64—
low_valuepub const fn low_value(&self) -> Option<f64>—
high_valuepub const fn high_value(&self) -> Option<f64>—
optimum_valuepub const fn optimum_value(&self) -> Option<f64>—
completionpub fn completion(&self) -> f32—
The `0.0..=1.0` position of the value inside the meter's range.
pub fn completion(&self) -> f32View sourceis_lowpub fn is_low(&self) -> bool—
is_highpub fn is_high(&self) -> bool—
Meter::root_with
View sourcepub fn root_with(&self, root: Element) -> ElementDecorate an application-owned root without adding layout or appearance.
Meter::root
View sourcepub fn root(&self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
Meter::track_with
View sourcepub fn track_with(&self, track: Element) -> ElementDecorate the caller-owned track that the fill is measured inside.
Meter::track
View sourcepub fn track(&self) -> ElementCreate the unstyled track part. Use [`Self::track_with`] to supply an existing element.
Meter::indicator_with
View sourcepub fn indicator_with(&self, indicator: Element) -> ElementHide an application-owned fill from the accessible name.
Meter::indicator
View sourcepub fn indicator(&self) -> ElementCreate the unstyled indicator part. Use [`Self::indicator_with`] to supply an existing element.
Meter::label_with
View sourcepub fn label_with(&self, label: Element) -> ElementAssign the stable mounted label target the root points at.
Meter::label
View sourcepub fn label(&self) -> ElementCreate the unstyled label part. Use [`Self::label_with`] to supply an existing element.
Meter::value
View sourcepub fn value(&self) -> ElementAssign the stable mounted value target the root points at. Create the unstyled value text part.
Meter::value_with
View sourcepub fn value_with(&self, value: Element) -> Elementmeter
View sourcepub fn meter(value: f64, minimum: f64, maximum: f64) -> ElementCreate an unstyled meter root. This shorthand is equivalent to `Meter::new(value, minimum, maximum).root_with(div())`.
