メーターMeterExperimental

Capacity / utilisation meter (role=meter): a value-against-max bar whose tone is derived from thresholds (near-full → warning, over → destructive), with an optional incoming overlay to preview 'after this change' and a compact inline size for table cells. For warehouse fill, truck load, storage usage and quota — or set direction='higher-is-better' with a target marker for occupancy / utilisation / SLA / yield goals, or direction='fill-is-good' (no target) for coverage / fulfillment. Pass formatValue to format the visible readout (e.g. grouped JPY).

プレビュー

重量積載率2100kg / 3000kg(70%)
棚 A-011350点 / 3000点(45%)
棚 B-072520点 / 3000点(84%)
棚 C-023000点 / 3000点(100%)
入居率(目標 90%)95%
設備稼働率(目標 90%)86%
工程能力 Cpk(目標 1.33)1.1 / 2(53%)
受注カバー率87%
予算消化(円)¥2,340,000 / ¥3,000,000(78%)
D-01
45%
D-02
90%
D-03
102%↑

Props

表は横にスクロールできます
プロパティ初期値説明
valuenumber-Current measured value.
maxnumber100Upper bound of the range.
incomingnumber-Extra amount layered on top of value as a striped overlay — preview the result of a pending change. Also drives the tone, so an overflow is flagged before it's committed.
thresholds{ warning?: number; over?: number }{ warning: 0.8, over: 1 }Fractions of max that flip the auto tone (near-full → warning, over → destructive).
direction"higher-is-worse" | "higher-is-better" | "fill-is-good""higher-is-worse"higher-is-worse (default) is capacity/load. higher-is-better flips it for occupancy/utilisation/SLA/yield — at/above target is success. fill-is-good tones by fill toward max (no target needed) — for coverage / fulfillment / completion.
targetnumber-Goal value (same units as value) drawn as a marker line on the track. With direction='higher-is-better' it also drives the auto tone; under the default direction it is a visual reference only.
formatValue(value: number) => string-Format the numbers in the visible readout (e.g. grouped JPY via formatCurrency). Overrides the default round(n,1) + unit. A percentage meter (unit='%', max 100) shows the value once instead of '/ 100%(%)'.
tone"success" | "warning" | "destructive" | "info" | "primary" | "muted"-Force the fill tone instead of deriving it from thresholds.
labelReactNode-Accessible name — a meter needs one.
valueText / unitstring-Override the announced value text, or set a unit suffix (kg / m³) for the default readout.
size"default" | "sm" | "inline""default"inline is a thin bar + compact % for table cells.
showValuebooleantrueShow the numeric readout.
classNamestring-Additional CSS class names.

Usage

import { Meter } from "@gunjo/ui"

// tone is derived from thresholds; incoming previews a pending change
<Meter
  label="重量積載率"
  value={2100}
  max={3000}
  incoming={350}              // striped overlay: "after I add this shipment"
  unit="kg"
  thresholds={{ warning: 0.8, over: 1 }}
/>

// compact size for a table cell
<Meter size="inline" value={41} max={40} label="棚 D-03 充填" />

// higher-is-better: at/above the target marker is success, just under it warns
<Meter
  label="入居率"
  value={87}
  max={100}
  unit="%"
  direction="higher-is-better"
  target={90}                  // goal line drawn on the track; drives the auto tone
/>