Introduction
Installation
Next.jsViteLaravelReact RouterRemixAstroTanStack StartTanStack RouterManual InstallationMCP
All componentsTheme
FieldFormInputText FieldTextareaSearch FieldInput OTPNumber FieldNumber FormatSliderCheckboxSwitchRadioSelectCombo BoxList BoxChoice BoxMulti SelectToken FieldNewTag FieldTag GroupCalendarDate FieldDate PickerDate Range PickerRange CalendarTime FieldColor PickerColor FieldColor AreaColor SliderColor SwatchColor Swatch PickerColor ThumbColor WheelDrop ZoneFile Trigger
ButtonButton GroupToggleToggle GroupPreskok Auth Button
EditorHeadingLinkTextKeyboard
CardContainerGrid ListResizableTableTreeSeparatorDescription ListScroll AreaShow MoreToolbar
BreadcrumbsNavbarPaginationTabsSidebar
DialogModalDrawerPopoverPreview TriggerNewSheetTooltipContext MenuDropdownCommandCommand MenuDisclosureMenu
ToastProgress BarProgress CircleMeterLoaderSkeletonNoteBadge
ChartArea ChartBar ChartLine ChartPie ChartRadial ChartRadar ChartBar ListTrackerRecharts ChartsDeprecated
Async ImageAvatarCarouselPreskok Icon
Charts

Chart

Chart foundations built on TanStack Charts, shared by every Preskok chart component.

View as MarkdownAsk ChatGPT

Every Preskok chart is built on TanStack Charts v1. The chart registry item holds what they share: the chart frame, the interactive legend, the tooltip, the --chart-* palette, and the mount animation. Install a chart component and chart comes with it.

Installation

npx shadcn@latest add @preskok/chart

Usage

Each chart takes the same config-driven data shape. Keys in config name the series in each row, and colors come from the --chart-1 to --chart-5 tokens in globals.css, so charts follow light and dark themes.

import { AreaChart } from "@/components/ui/preskok-ui/area-chart"
import { ChartLegend } from "@/components/ui/preskok-ui/chart"

const data = [
  { month: "Jan", revenue: 42, sales: 28 },
  { month: "Feb", revenue: 64, sales: 39 },
]

const config = {
  revenue: { label: "Revenue", color: "var(--chart-1)" },
  sales: { label: "Sales", color: "var(--chart-2)" },
} as const

export function RevenueChart() {
  return (
    <AreaChart
      config={config}
      data={data}
      dataKey="month"
      legend={<ChartLegend align="left" />}
      size={{ height: 256 }}
      valueFormatter={(value) => `$${value}k`}
    />
  )
}

Components

  • Area chart
  • Bar chart
  • Line chart
  • Pie chart
  • Radial chart
  • Radar chart

Features

  • Mount animation: area and line charts reveal left to right, bars and slices grow in, and both respect reduced motion
  • Interactive legend that highlights one series from a click or the keyboard
  • Shared tooltip with dot, line, or dashed indicators
  • Theme-aware palette from the --chart-* tokens
  • One sizing API through size (height, aspectRatio, initialWidth)

Migrating from Recharts

The earlier Recharts components are deprecated. The props are close but not identical:

RechartsTanStack
className="h-64"size={{ height: 256 }}
hideGridLinesgrid="hidden"
hideXAxis, xAxisPropsxAxis={false}, xAxis={{ ... }}
hideYAxis, yAxisPropsyAxis={false}, yAxis={{ ... }}
legendPropslegend={<ChartLegend ... />}
Any color stringvar(--chart-1) to var(--chart-5)
barProps={{ onClick }}onBarClick={(row) => ...}
xAxisProps={{ interval: 0 }}categoryAxis={{ tickStrategy: "all", labelRotation: -35 }}

Badge

Small label component to highlight statuses, counts, or categories.

Area Chart

Area chart for trends over time, with gradient fills, stacking, and a left-to-right reveal on mount.

On this page

Installation
Usage
Components
Features
Migrating from Recharts
Day 1Day 2Day 3Day 4Day 5Day 6Day 70100200300400500600700