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
Chart (helpers)Area ChartBar ChartLine ChartPie ChartExperimental ChartsNewExperimental Radial ChartNewExperimental Radar ChartNewBar ListTracker
Async ImageAvatarCarouselPreskok Icon
Charts

Chart (helpers)

Core chart context, tooltip, legend, and axes used by Preskok chart components.

View as MarkdownAsk ChatGPT

Installation

npx shadcn@latest add @preskok/chart

Usage

import { Area, AreaChart as AreaChartPrimitive } from "recharts"

import {
  CartesianGrid,
  Chart,
  ChartLegend,
  ChartLegendContent,
  ChartTooltip,
  ChartTooltipContent,
  XAxis,
  YAxis,
} from "@/components/ui/preskok-ui/chart"

const data = [
  { day: "Mon", Desktop: 120, Mobile: 80 },
  { day: "Tue", Desktop: 200, Mobile: 130 },
]

const config = {
  Desktop: { label: "Desktop", color: "#2563eb" },
  Mobile: { label: "Mobile", color: "#60a5fa" },
}

export function ChartDemo() {
  return (
    <Chart data={data} dataKey="day" config={config}>
      {() => (
        <AreaChartPrimitive data={data}>
          <CartesianGrid strokeDasharray="3 3" />
          <XAxis />
          <YAxis />
          <ChartLegend content={<ChartLegendContent />} />
          <ChartTooltip content={<ChartTooltipContent />} />
          <Area
            type="monotone"
            dataKey="Desktop"
            stroke="#2563eb"
            fill="#2563eb"
            fillOpacity={0.3}
          />
          <Area
            type="monotone"
            dataKey="Mobile"
            stroke="#60a5fa"
            fill="#60a5fa"
            fillOpacity={0.3}
          />
        </AreaChartPrimitive>
      )}
    </Chart>
  )
}

Features

  • Context for shared chart props and selection state
  • Legend with selection filtering
  • Tooltip with configurable content
  • Axes helpers with sensible defaults

Badge

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

Area Chart

Area chart for visualizing trends over time with gradients, tooltips, and legends.

On this page

Installation
Usage
Features