Skip to main contentSkip to navigation

Chart Tooltip

Customizable tooltip component for all chart types.

Overview

The chart tooltip component provides a consistent, themed tooltip across all chart types. It integrates with the chart config system for automatic label and color resolution.

Usage

import { ChartTooltip, ChartTooltipContent } from "@hanzo/ui"

// Inside any chart component:
;<ChartTooltip content={<ChartTooltipContent />} />

Props

ChartTooltipContent

PropTypeDefaultDescription
hideLabelbooleanfalseHide the label in tooltip
hideIndicatorbooleanfalseHide the color indicator
indicator"line" | "dot" | "dashed""dot"Indicator style
nameKeystring-Key for item names
labelKeystring-Key for labels

Customization

Custom Formatter

<ChartTooltip
  content={
    <ChartTooltipContent
      formatter={(value, name) => (
        <span>
          {name}: ${value.toLocaleString()}
        </span>
      )}
    />
  }
/>

Custom Label

<ChartTooltip
  content={<ChartTooltipContent labelFormatter={(label) => `Date: ${label}`} />}
/>

Indicator Styles

  • dot - Small colored circle (default)
  • line - Colored line indicator
  • dashed - Dashed line indicator