Meter
A measure inside a known range, read at a glance: disk used, connections. Past warnAt it warns and past failAt it fails, in colour and in words.
import { Meter, MeterSkeleton } from '@sypnia/ui/react'
Three resources and a skeleton
CPU34%
Disk86 GB of 100 GB
Connections98 of 100
Code
import { Meter, MeterSkeleton } from '@sypnia/ui/react';
// A measure in a range. Past 80 it warns; past 95 it fails, in colour and in words.
export default function Disk() {
return (
<div className="sy-stack">
<Meter label="CPU" value={34} />
<Meter label="Disk" value={86} warnAt={80} failAt={95} valueText="86 GB of 100 GB" />
<Meter label="Connections" value={98} warnAt={80} failAt={95} valueText="98 of 100" />
<MeterSkeleton />
</div>
);
} When to use it
Use it when
- Resources with a ceiling: CPU, disk, connections.
Do not use it when
- A task moving forward: use Progress.
- A plan's limit with a next step: use UsageBar.
For everyone
- It is a
meterwith the value in words (aria-valuetext).
Props
| Meter | Type | Default |
|---|---|---|
labelrequired | ReactNode | |
valuerequired | number | |
failAt | number | |
max | number | 100 |
min | number | 0 |
valueTextHow the value is said: «62 GB of 100 GB». Defaults to a percent. | string | |
warnAt | number |