Turns amber at 60% and red at 85%.
Playground
Change the props and copy the code. The controls come from the component's TypeScript types.
Props
import { Gauge } from "@/components/ui/charts";<Gauge value={72} label="CPU" />Installation
$ pnpm dlx shadcn@latest add @synccn/gaugeFirst time in this project? Connect synccn with one command.
Usage
import { Gauge } from "@/components/ui/charts";<Gauge value={42} label="CPU usage" />API reference
Generated from the component's TypeScript types, so it always matches the code.
Gauge
Half-circle gauge with optional threshold colours.
- valuerequired
numberCurrent value.
- max
numberDefault
100Value that fills the gauge.
- label
stringCaption under the value.
- size
numberDefault
220Width in pixels.
- thresholds
[number, number]Default
[60, 85]Percentages where the colour turns amber, then red.
- format
(value: number) => React.ReactNodeDefault
(v) => Math.round(v)Formats the centre value.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
Accessibility
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: img, meter
- ARIA attributes: aria-label, aria-pressed, aria-valuemax, aria-valuemin, aria-valuenow