suiss/ui
  • Docs
  • Components
  • Patterns
  • Interactions
  • Charts
  • Blocks
GitHubGet started
DocsComponentsPatternsInteractionsChartsBlocks
Charts70
  • Overview
Area
  • Axes
  • Default
  • Gradient
  • Interactive
  • Linear
  • Range
  • Sparkline
  • Stacked
  • Stacked Expand
  • Step
Bar
  • Active
  • Default
  • Horizontal
  • Hourly
  • Interactive
  • Labeled
  • Multiple
  • Negative
  • Range
  • Stacked
Line
  • Default
  • Dots
  • Forecast
  • Goal
  • Goal Dots
  • Interactive
  • Labeled
  • Linear
  • Multiple
  • Step
Pie
  • Active
  • Default
  • Donut
  • Donut Text
  • Half
  • Interactive
  • Label
  • Legend
  • Nested
  • Separated
Radar
  • Default
  • Dots
  • Grid Circle
  • Grid Filled
  • Grid None
  • Interactive
  • Legend
  • Lines Only
  • Multiple
  • Radius Axis
Radial
  • Batteries
  • Default
  • Gauge
  • Interactive
  • Label
  • Progress
  • Rings
  • Stacked
  • Text
  • Tinted
Tooltip
  • Custom
  • Dashed
  • Dot
  • Formatter
  • Icons
  • Interactive
  • Label Formatter
  • Line
  • No Indicator
  • No Label

suiss/ui · Chart

Tooltip Chart Dashed

A stacked bar chart whose tooltip marks each series with a dashed outline indicator.

Tooltip Chart Dashed is an open-source chart from suiss/ui for React. The @esuiss/ui CLI copies its source into your project, so you own the code.

components/charts/tooltip-chart-dashed.tsx
"use client"

import { Bar, BarChart, XAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,

A stacked bar chart that shows the dashed tooltip indicator, which marks each series with a dashed outline in its color. Compare it with the dot and line variants to pick the indicator that fits your design.

Installation

CLI

$ pnpm dlx shadcn@latest add @esuiss/tooltip-chart-dashed

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add charts tooltip-chart-dashed

Manual

  1. Install the dependencies:
$ pnpm add recharts
  1. Add the pieces it builds on: Card, Chart.

  2. Copy the source into components/charts/tooltip-chart-dashed.tsx:

components/charts/tooltip-chart-dashed.tsx
"use client"

import { Bar, BarChart, XAxis } from "recharts"

import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
  1. Update the import paths to match your project.

Usage

import { TooltipChartDashed } from "@/components/charts/tooltip-chart-dashed"
<TooltipChartDashed />

Set indicator on ChartTooltipContent to dashed; the same setting works on any chart. Replace chartData and the series in chartConfig to use your own data.

Notes

The tooltip opens on a preset month when the chart loads; remove defaultIndex if it should start hidden.

NextTooltip Chart DotPreviousTooltip Chart Custom

On this page

  1. 01Installation
    • CLI
    • Manual
  2. 02Usage
  3. 03Notes