Brutalist Meter
Display a scalar measurement within a known range with optimal, suboptimal, and critical thresholds.
Brutalist Meter displays a scalar measurement within a known range—such as storage usage, quota, or score—using 5px rounded-base geometry, 2px black borders, DM Sans medium typography, instant snap updates, and distinct primary, canary, and destructive status fills.
Preview
Section titled “Preview” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div
id="brutalist-meter-hero"
class="mx-auto grid w-full max-w-md gap-4"
>
<proto-ui-brutalist-meter-root id="brutalist-meter">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
Storage used
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
<div class="flex flex-wrap items-center gap-2">
<proto-ui-brutalist-button data-preset="optimal">
Optimal (32%)
</proto-ui-brutalist-button>
<proto-ui-brutalist-button data-preset="suboptimal">
Warning (68%)
</proto-ui-brutalist-button>
<proto-ui-brutalist-button data-preset="critical">
Critical (92%)
</proto-ui-brutalist-button>
</div>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const meter = document.querySelector('#brutalist-meter');
const base = { min: 0, max: 100, low: 50, high: 80, optimum: 20 };
const presets = {
optimal: { value: 32, valueText: '32 GB / 100 GB' },
suboptimal: { value: 68, valueText: '68 GB / 100 GB' },
critical: { value: 92, valueText: '92 GB / 100 GB' },
};
setElementProps(meter, { ...base, ...presets.optimal });
for (const [key, preset] of Object.entries(presets)) {
const btn = document.querySelector(
`#brutalist-meter-hero [data-preset="${key}"]`
);
setElementProps(btn, {
onClick: () => setElementProps(meter, { ...base, ...preset }),
});
}
</script>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases. Import the meter parts from @proto.ui/prototypes-brutalist/meter:
import { meterRoot, meterLabel, meterTrack, meterIndicator, meterValue,} from '@proto.ui/prototypes-brutalist/meter';import { AdaptToReact } from '@proto.ui/adapter-react';import { meterRoot, meterLabel, meterTrack, meterIndicator, meterValue,} from '@proto.ui/prototypes-brutalist/meter';
const MeterRoot = AdaptToReact(meterRoot);const MeterLabel = AdaptToReact(meterLabel);const MeterTrack = AdaptToReact(meterTrack);const MeterIndicator = AdaptToReact(meterIndicator);const MeterValue = AdaptToReact(meterValue);
export function BrutalistStorageMeter() { return ( <MeterRoot value={32} min={0} max={100} low={50} high={80} optimum={20} valueText="32%"> <div className="flex items-center justify-between gap-2"> <MeterLabel>Storage used</MeterLabel> <MeterValue /> </div> <MeterTrack> <MeterIndicator /> </MeterTrack> </MeterRoot> );}Parts and thresholds
Section titled “Parts and thresholds”- Root: Manages
value, finite[min, max]bounds, and optionallow,high, andoptimumthresholds. Values clamp to[min, max], and equal bounds produce0percentage. - Label / Value: Preserve authored text casing with DM Sans 500 typography;
Valueusestabular-numsand displaysvalueTextor the clamped numeric reading. - Track / Indicator: The track uses
rounded-base,border-2 border-black, andbg-secondary-background; the indicator mapsoptimal(bg-primary),suboptimal(bg-canary), andcritical(bg-destructive) with instant snap updates. - Meter is a passive readout (
role="meter") with no keyboard tab stop; all parts stay synchronized and exposevalue,percentage,indeterminate, andstatus.
Examples
Section titled “Examples”Threshold zones (optimal / suboptimal / critical)
Section titled “Threshold zones (optimal / suboptimal / critical)” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div
id="brutalist-meter-zones"
class="mx-auto grid w-full max-w-md gap-5"
>
<proto-ui-brutalist-meter-root data-zone="optimal">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
Disk usage (optimal)
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
<proto-ui-brutalist-meter-root data-zone="suboptimal">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
Disk usage (suboptimal)
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
<proto-ui-brutalist-meter-root data-zone="critical">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
Disk usage (critical)
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
<proto-ui-brutalist-meter-root data-zone="battery">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
Battery charge (higher is better)
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const configs = {
optimal: {
value: 32,
low: 50,
high: 80,
optimum: 20,
valueText: '32%',
},
suboptimal: {
value: 68,
low: 50,
high: 80,
optimum: 20,
valueText: '68%',
},
critical: {
value: 92,
low: 50,
high: 80,
optimum: 20,
valueText: '92%',
},
battery: {
value: 88,
low: 25,
high: 60,
optimum: 95,
valueText: '88%',
},
};
for (const [key, props] of Object.entries(configs)) {
setElementProps(
document.querySelector(
`#brutalist-meter-zones [data-zone="${key}"]`
),
props
);
}
</script>Custom range and formatted valueText
Section titled “Custom range and formatted valueText” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div
id="brutalist-meter-range"
class="mx-auto grid w-full max-w-md gap-5"
>
<proto-ui-brutalist-meter-root data-range="storage">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
Cloud storage
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
<proto-ui-brutalist-meter-root data-range="api">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
Monthly API calls
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector(
'#brutalist-meter-range [data-range="storage"]'
),
{
value: 384,
min: 0,
max: 512,
low: 256,
high: 420,
optimum: 128,
valueText: '384 GB / 512 GB',
}
);
setElementProps(
document.querySelector(
'#brutalist-meter-range [data-range="api"]'
),
{
value: 9200,
min: 0,
max: 10000,
low: 5000,
high: 8500,
optimum: 1000,
valueText: '9,200 / 10,000 req',
}
);
</script>Resource quota panel
Section titled “Resource quota panel” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div
id="brutalist-quota-card"
class="mx-auto grid w-full max-w-md gap-4 rounded-xl border p-5"
>
<proto-ui-brutalist-meter-root data-metric="cpu">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
CPU allocation
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
<proto-ui-brutalist-meter-root data-metric="memory">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
Memory
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
<proto-ui-brutalist-meter-root data-metric="ssd">
<div class="flex items-center justify-between gap-2">
<proto-ui-brutalist-meter-label>
SSD volume
</proto-ui-brutalist-meter-label>
<proto-ui-brutalist-meter-value></proto-ui-brutalist-meter-value>
</div>
<proto-ui-brutalist-meter-track>
<proto-ui-brutalist-meter-indicator></proto-ui-brutalist-meter-indicator>
</proto-ui-brutalist-meter-track>
</proto-ui-brutalist-meter-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const metrics = {
cpu: {
value: 28,
min: 0,
max: 100,
low: 60,
high: 85,
optimum: 20,
valueText: '28%',
},
memory: {
value: 11.4,
min: 0,
max: 16,
low: 10,
high: 14,
optimum: 4,
valueText: '11.4 GB / 16 GB',
},
ssd: {
value: 468,
min: 0,
max: 500,
low: 300,
high: 425,
optimum: 100,
valueText: '468 GB / 500 GB',
},
};
for (const [key, props] of Object.entries(metrics)) {
setElementProps(
document.querySelector(
`#brutalist-quota-card [data-metric="${key}"]`
),
props
);
}
</script>| Prop | Type | Default |
|---|---|---|
value | number undefined | undefined |
min | number | 0 |
max | number | 100 |
low | number undefined | undefined |
high | number undefined | undefined |
optimum | number undefined | undefined |
ariaLabel | string | '' |
valueText | string | '' |
Label, Track, Indicator, and Value declare no props of their own.
Exposed states
Section titled “Exposed states”| State | Type | Notes |
|---|---|---|
value | State<number> | Current reading clamped to [min, max] |
percentage | State<number> | Normalized percentage between 0 and 100 |
status | State<string> | 'optimal' | 'suboptimal' | 'critical' |
indeterminate | State<boolean> | Always false for Meter |