Meter

View as Markdown

How much of a fixed amount is used, such as disk space. It turns amber, then red, near full.

CPU
x
Memory

Getting full. Restart the queue worker or move to a larger machine.

x
Disk

Almost full. Writes fail when it's full. Rotate the logs in /var/log.

x

When to use

How much of a fixed amount is used, such as disk space. It turns amber, then red, near full. Use Progress instead when the bar shows a task's progress.

Usage

import { Meter } from "./ui/uicontext/components/Meter.ts"
export const Seats = <M>(h: Html.H<M>) => Meter(h, { label: "Seats", value: 31, max: 50, valueText: "31 of 50" })

Examples

What uses it

MeterBreakdown splits the bar by part, with a legend that names each and what's free.

Storage
  • Videos84.6 GB
  • Photos41.3 GB
  • Documents12.8 GB
  • Other6.1 GB
  • Free55.2 GB
x

API reference

MeterView function

Options

Meter options
NameTypeDefaultDescription
keystring—Names the meter among others in the same view; needed for more than one.
labelrequiredstring—What's measured: "Disk", "Memory", "Battery".
valuerequirednumber——
maxnumber100100 by default.
valueTextstring—The words beside the label and read out with it: "41.2 of 50 GB". A percentage by default.
warnnumber0.8The share, 0 to 1, where it turns amber; 0.8 by default.
criticalnumber0.95The share where it turns red; 0.95 by default.
advicestring—What to do about it, under the bar once it's past warn: "Delete old recordings or upgrade."
thinboolean—A thinner bar, for a row in a list.
styleStyle——

MeterBreakdownView function

Options

MeterBreakdown options
NameTypeDescription
keystringNames the meter among others in the same view; needed for more than one.
labelrequiredstring—
partsrequiredMeterPart[]What each part uses, largest first reads best; up to six.
maxrequirednumber—
unitstring"GB", "seats": written after each number.
localestring—
styleStyle—

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/meter

Source