Gauge
A semicircle dial with a spring needle and a rolling reading: the sweep and the needle ride custom properties with CSS transitions, so any Livewire morph that changes the value re-runs them from wherever they stopped; the active zone colours the sweep, the hub dot and the caption, and the same data ships as a hidden table.
Real scenarios
The component as it is used in a product — not a specimen grid.
The support queue, live
The value lives in Livewire state and the shift buttons move it — the sweep and the needle ride custom properties with CSS transitions, so every morph re-runs them from exactly where they stopped and the digits roll. The zone the reading sits in recolours the sweep, the hub dot and the caption (Safe · Caution · Critical, from the core i18n table), and the same data ships as a hidden table for screen readers.
Support queue load
All channels · this shift
72 % Caution
| Zone | Range |
|---|---|
| Safe | 0 – 60 |
| Caution | 60 – 85 |
| Critical | 85 – 100 |
| Value | 72 of 100 |
Without zones the dial takes its default thirds — safe to 60%, caution to 85%, critical beyond — and the reading formats in the page’s own digits (۷۲ on a Persian page, 72 on an English one).
The Growth plan’s token cap
Zones need not be the default thirds: each takes its own upTo, tone and label, and the last one — upTo omitted — runs to the cap. A fractional value gains one decimal on its own and decimals="2" pins it down; 4.53 lands in “Near the cap” and wears its colour.
Model-token spend
Growth plan · resets on the 1st
4.53 M Near the cap
| Zone | Range |
|---|---|
| Calm | 0.00 – 2.50 |
| Busy | 2.50 – 4.20 |
| Near the cap | 4.20 – 5.00 |
| Value | 4.53 of 5.00 |
Leave a zone’s label off and the tone’s own word arrives from the core i18n table; zone-label="" removes the caption under the figure altogether.
The agent’s health board
Two compact dials (size rides --nx-gauge-size) — and “bad” points wherever you say: in the reply-time gauge less is better, so the success zone sits first; satisfaction is the other way round. The dial mirrors in RTL, min parking at the inline-start end.
Median first reply
All channels · last hour
412 ms Slowing
| Zone | Range |
|---|---|
| Snappy | 0 – 300 |
| Slowing | 300 – 600 |
| Stuck | 600 – 800 |
| Value | 412 of 800 |
Conversation satisfaction
Ratings this week
93 % Excellent
| Zone | Range |
|---|---|
| Needs care | 0 – 70 |
| Good | 70 – 90 |
| Excellent | 90 – 100 |
| Value | 93 of 100 |
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| value / min / max | number | 0 / 0 / 100 | The reading and the range’s ends; a value past the ends clips to them, and min parks at the inline-start end (the dial mirrors in RTL). |
| zones | array | سهقسمت پیشفرض | Default: success to 60% of the span, warning to 85%, danger beyond. Each zone takes ['upTo' => …, 'tone' => success|warning|danger|info|accent, 'label' => …]; the last upTo may be omitted to run to the cap, and without a label the tone’s own word arrives from the core i18n table. |
| title / subtitle / unit | string | null | The chart head’s title and subtitle, and the small unit beside the figure. |
| zoneLabel | string | null | The caption under the figure; null means the active zone’s name, an empty string hides it. |
| size | string | int | null (26rem) | The dial’s width — riding --nx-gauge-size; a number means px, a string (15rem, say) lands as written. |
| decimals / locale / labels | int / string / array | null / null / [] | The fraction digits (0 for whole numbers, 1 for fractional ones by default), the digits-and-words locale (the app’s by default) and overrides for the built-in words. |
Snippet
<x-nx::gauge :value="$metrics->load" unit="٪" title="بار صف پشتیبانی" subtitle="همهٔ کانالها · شیفت جاری" />
{{-- ناحیههای سفارشی — آخرین ناحیه بدون upTo تا سقف میرود --}}
<x-nx::gauge :value="4.53" :max="5" :decimals="2" unit="M" title="مصرف ماهانهٔ توکن مدل"
:zones="[
['upTo' => 2.5, 'tone' => 'success', 'label' => 'آرام'],
['upTo' => 4.2, 'tone' => 'warning', 'label' => 'پرترافیک'],
['tone' => 'danger', 'label' => 'نزدیک سقف'],
]" />