Skip to content

Gauge

A progress gauge and donut visualisation component for Ink 5 terminal dashboards.

Install

Terminal window
npm install @matthesketh/ink-gauge

Usage

Gauge (horizontal bar)

import { Gauge } from '@matthesketh/ink-gauge';
<Gauge value={75} />
<Gauge value={45} label="CPU" width={10} />
<Gauge
value={90}
thresholds={[
{ value: 80, color: 'yellow' },
{ value: 95, color: 'red' },
]}
/>

Donut

import { Donut } from '@matthesketh/ink-gauge';
<Donut value={40} />
<Donut value={75} size="large" />

API

<Gauge />

PropTypeDefaultDescription
valuenumberrequired0-100 percentage
widthnumber20Bar character count
filledCharstring-Character for filled portion
emptyCharstring-Character for empty portion
colorstring'green'Colour of filled portion
showPercentagebooleantrueShow percentage after bar
labelstring-Label before bar
thresholds{ value: number; color: string }[]-Auto-select colour based on value

<Donut />

PropTypeDefaultDescription
valuenumberrequired0-100 percentage
labelstring-Centre/end label
colorstring'green'Colour
size'small' | 'large''small'Small = 1 line, large = 3 line

License

MIT