Example#
Your estimate
$3,200 to $4,800
Usage#
Use the ruler readout to report a range the page has worked out, such as the estimator's price band. The numbers come first as visible text; the ruler underneath is a picture of where the band sits.
- Read-only. It never takes input; to let people choose a value, use
Slider. - Sticky. On the estimator it sits in a sticky plate, so the answer stays in view while the questions change it.
- Format once.
formatprints both ends ("$3,200 to $4,800");toLabelchanges the joining word for other languages.
Anatomy#
Your estimate
$3,200 to $4,800
- LabelWhat the band is.
.mk-ruler-readout-label - ValueBoth ends as text, in the numeral role.
.mk-ruler-readout-value - RulerThe band between two end ticks; hidden from assistive tech.
.mk-ruler-readout-ruler
Volume#
Reading layer: identical at every volume.
Quiet
Your estimate
$3,200 to $4,800
Studio
Your estimate
$3,200 to $4,800
Press
Your estimate
$3,200 to $4,800
Rave
Your estimate
$3,200 to $4,800
Content#
- Say what the band is in the label: "Your estimate", not "Range".
- Write both ends in full with the currency: "$3,200 to $4,800".
- If the band is an estimate, say so nearby in words; the ruler never carries a caveat by itself.
Do and don't#
Do
Your estimate
$3,200 to $4,800
Don't
Somewhere in the low thousands.
Accessibility#
- The numbers are text; the ruler drawing is hidden from assistive tech.
- Prices stay literal.
| Keys | What happens |
|---|---|
| (none) | Not interactive |
The colour pairs it prints, with their contrast on both papers:
| Text | Surface | Role | Bone | Night |
|---|---|---|---|---|
--mk-text | --mk-surface | ui | not in this look | not in this look |
--mk-text-2 | --mk-surface | ui | not in this look | not in this look |
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
min required | number | none | |
max required | number | none | |
value required | number | readonly [number, number] | none | One value, or the band `[lo, hi]`. |
marks | readonly SliderMark[] | none | |
format | ((value: number) => string) | none | |
toLabel | string | "to" | Joins the band's ends (default "to"). |
label | string | none | An optional caption above the numbers, e.g. "Your estimate". |
Tokens#
System tokens (20)
--mk-display-family--mk-font-text--mk-selected--mk-space-2--mk-text--mk-text-2--mk-track-numeral-m--mk-type-label-leading--mk-type-label-size--mk-type-label-weight--mk-type-meta-leading--mk-type-meta-size--mk-type-meta-weight--mk-type-numeral-m-leading--mk-type-numeral-m-size--mk-type-row-title-size--mk-type-row-title-tracking--mk-type-row-title-weight--mk-wd-numeral-m--mk-wght-numeral-m
Changelog#
Arrived in 0.1.0.
- The reading layer's controls, overlays, forms and visitor prefs (P2-T1 to P2-T5): every Button is the comic hit key, with IconButton, Link and Tooltip; Input, Textarea, Select, Checkbox and CheckboxGroup, Radio and RadioGroup, Switch, Slider with the ruler, RulerReadout and SegmentedControl; Dialog, Drawer, NavSheet, Tabs, Disclosure, Faq and faqJsonLd on Base UI 1.9 where the platform falls short; Field, Fieldset, Form with the site's inline validation, ErrorSummary, Callout, Honeypot, FormTimestamp and QuoteForm; PrefsScript under 1 KB, usePref and setPref with cross-tab sync, ThemeToggle and the visitor VolumeDial; VisuallyHidden.