- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Desktop Window
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Frame
- Heading
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Live Waveform
- Marker
- Menubar
- Message
- Message Scroller
- Meter
- Meter Ring
- Native Select
- Navigation Menu
- NumberCount
- Pagination
- Popover
- Progress
- Progress Ring
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Timeline
- Toast
- Toggle
- Toggle Group
- Tooltip
A linear reading of a bounded value, such as a score, a utilization, or a fill level.
import { Meter } from "@/components/ui/meter"
export default function MeterDemo() {Four components cover this ground. Meter and
MeterRing report a value that simply is what
it is; Progress and
ProgressRing report a task climbing toward
completion. Pick the shape — bar or ring — second.
Installation#
bunx --bun shadcn@latest add @ondo-ui/meter
Usage#
import { Meter, MeterLabel, MeterValue } from "@/components/ui/meter"<Meter value={72} min={0} max={100} variant="default">
<MeterLabel>Disk used</MeterLabel>
<MeterValue />
</Meter>Meter builds on Base UI's Meter, so it is announced as a meter with the
right aria-valuenow and aria-valuetext. Unlike Progress it has no
indeterminate state — a meter always has a reading.
Children render above the track, which is where MeterLabel and MeterValue
go. The bar fills with bg-current, so variant — or any text-color utility
in className — recolors it.
Composition#
Meter
├── MeterLabel
├── MeterValue
└── MeterTrack
└── MeterIndicatorExamples#
Label and value#
MeterLabel names the reading and MeterValue prints it. MeterValue sits
hard right, so the pair reads as one row above the bar.
import { Meter, MeterLabel, MeterValue } from "@/components/ui/meter"
export default function MeterLabelDemo() {Variants#
variant picks the bar color from the theme's semantic set. Which band a
reading falls into is yours to decide, so pick the variant from the value at the
call site.
import { Meter, MeterLabel, MeterValue } from "@/components/ui/meter"
export default function MeterVariants() {Formatting the value#
format takes Intl.NumberFormat options and shapes both the printed text and
the value announced to screen readers. MeterValue also takes a render function
when the reading needs surrounding words.
That render function is a function prop, so the component passing it has to be a Client Component.
"use client"
import { Meter, MeterLabel, MeterValue } from "@/components/ui/meter"API reference#
Meter#
| Prop | Type | Default |
|---|---|---|
value | number | – |
min | number | 0 |
max | number | 100 |
variant | "default" | "info" | "success" | "warning" | "destructive" | "default" |
format | Intl.NumberFormatOptions | – |
locale | Intl.LocalesArgument | runtime locale |
getAriaValueText | (formatted: string, value: number) => string | – |
Plus the rest of Base UI's Meter.Root props.
MeterTrack, MeterIndicator#
The bar and its fill. Meter composes them for you; reach for them only to
restyle the track.
MeterLabel, MeterValue#
Base UI's Meter.Label and Meter.Value with ondo styling. MeterValue takes a
render function ((formatted, value) => ReactNode) when format alone is not
enough.