Menu

Chart

Chart card (bar, line, donut). 3 types.

Orders this week299+18%
SatSunMonTueWedThuFri
  • Sat: 32
  • Sun: 41
  • Mon: 28
  • Tue: 52
  • Wed: 47
  • Thu: 61
  • Fri: 38

Installation

$ npx uix-ui@latest add chart

This copies the file into components/ui/chart.tsx in your project. npx shadcn@latest add @uix/chart works too.

Usage

chart.tsx
import { Chart } from "@/components/ui/chart";

<div style={{ width: 440, maxWidth: "100%" }}>
  <Chart type="bar" data={data} title="Orders this week" value="299" delta="+18%" highlight={5} />
</div>

Props

PropTypeDefaultDescription
typebar | line | donut"bar"
dataChartDatum[]–
titleReact.ReactNode–
valueReact.ReactNode–Headline figure, for example $48.2k.
deltaReact.ReactNode–Change next to the value, for example 12.5%.
highlightnumber–Bar chart: index of the highlighted bar (defaults to the tallest).

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
  • components/ui/icons.tsx
esc

↑↓ to navigate · ↵ to select · esc to close