Examples
Gauge Pro
One value against its range: a health score, a credit score, storage used, a speed. segments color the track by range (poor, fair, good) and the fill takes the color of the range it's in, with the range's name under the value. target marks a goal on the track, and showNeedle swaps the fill for a needle. The arc sweeps to each new value.
import { GaugeChart } from '@patine-ui/pro';
Live data
Loading…
<View style={{ width: 380, flexDirection: 'row', gap: 12 }}> <GaugeChart value={score} segments={health} target={80} accessibilityLabel="Account health" height={170} style={{ flex: 1 }} /> <GaugeChart value={score} segments={health} showNeedle accessibilityLabel="Account health" height={170} style={{ flex: 1 }} /> </View>
Try the props
valuetargetstartAngleendAnglethicknessdesign<GaugeChart segments={health} value={82} />
Example: a monthly budget
A spending app's Groceries budget: the gauge fills with what's spent, turns amber past 80% and red past the limit, and the needle-free arc keeps it readable at a glance. Add an expense to watch it move.
Loading…
<View style={{ width: '100%', maxWidth: 360, gap: 8 }}> <Text weight="semibold">Groceries · November</Text> <GaugeChart value={spent} max={LIMIT * 1.2} segments={[ { to: LIMIT * 0.8, color: '#16A34A', label: 'On track' }, { to: LIMIT, color: '#D97706', label: 'Close to the limit' }, { to: LIMIT * 1.2, color: '#DC2626', label: 'Over budget' }, ]} target={LIMIT} label={`€${spent} of €${LIMIT}`} height={180} accessibilityLabel={`Groceries: €${spent} of €${LIMIT}`} /> <HStack gap="sm" justify="center"> <Button size="sm" variant="outline" onPress={() => setSpent((s) => s + 42)}>Add €42 shop</Button> <Button size="sm" variant="ghost" onPress={() => setSpent(318)}>Reset</Button> </HStack> </View>
Gallery
Loading…
<View style={{ width: 380, flexDirection: 'row', gap: 12 }}> <GaugeChart value={0.68} max={1} valueFormat="percent" label="Storage" startAngle={-90} endAngle={90} height={110} style={{ flex: 1 }} /> <GaugeChart value={742} min={300} max={850} label="Credit score" thickness={0.08} height={150} style={{ flex: 1 }} /> </View>
Props
The shared chart props except data, the legend and tooltip props, and:
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | — | |
min / max | number | 0 / 100 | |
segments | { to, color?, label? }[] | — | Colored ranges, each from the last one's end up to to. |
target | number | — | A mark on the track. |
label | string | the range's label | Under the value. |
startAngle / endAngle | number | -120 / 120 | Degrees clockwise from 12 o'clock. -90/90 is a half circle. |
thickness | number | 0.16 | The track's width as a share of the radius. |
showNeedle | boolean | false | A needle over the colored ranges instead of a filled arc. |
showMinMax | boolean | true | min and max at the arc's ends. |
color | string | the range's, or primary | The fill. |
height | number | 200 |