shadcn.io is not affiliated with official shadcn/ui
About
Strip the tooltip to its rows: each series' name and value, no date on top and no dot beside them. Use it on small charts where the hovered bar and its axis tick already say where you are, and the tooltip only needs the numbers.
It's the default tooltip with two options turned on, so it's easy to bring either part back.
Installation
Usage
import { ChartTooltipLabelNone } from "@/components/charts/chart-tooltip-label-none";<ChartTooltipLabelNone />Customize
<ChartTooltipContent hideIndicator hideLabel />makes the change.- The
<XAxis>ticks keep the weekday on screen. defaultIndex={1}opens the tooltip on the second day;cursor={false}hides the hover band.
FAQ
Which options make this tooltip?
<ChartTooltipContent hideIndicator hideLabel />: the first drops the dots, the second the date heading.
When can I drop the label?
When the x position is plain from what's hovered: a few bars with their names on the axis, or a single point. If the reader could lose track of which day they're on, keep the label.
Can I hide the label but keep the dots?
Yes: <ChartTooltipContent hideLabel />. The Icons and Advanced variants also hide the label and keep a mark beside the name.
API Reference
ChartContainer
configChartConfig
Each series by its data key: its label, an icon, and a color (or a * theme color per light and dark), read by the tooltip and legend and set * as --color-<key>.
initialDimension?{ height: number; width: number; }
The size it renders at before it's measured, so the first paint isn't * empty.
- Type
{ height: number; width: number; }- Default
INITIAL_DIMENSION
className?string
Merged with the part's classes.
ChartLegend
ChartLegendContent
<div>
hideIcon?boolean
Hides each series' icon (from config), leaving its color swatch.
- Default
false
nameKey?string
The key in each legend item's data to look its label up by in config. * Defaults to the item's dataKey.
className?string
Merged with the part's classes.
ChartStyle
<style>
configChartConfig
The chart config whose colors it writes as --color-<key> variables.
idstring
The element's id.
ChartTooltip
ChartTooltipContent
<div>
hideIndicator?boolean
Hides each item's color indicator.
- Default
false
hideLabel?boolean
Hides the tooltip's label, the hovered point's.
- Default
false
indicator?"dashed" | "dot" | "line"
The color indicator's shape: a dot, a line or dashed.
- Type
"dashed" | "dot" | "line"- Default
"dot"
labelFormatter?(label: any, payload: TooltipPayload) → React.ReactNode
Formats the tooltip's label; its value is untyped, as in recharts 3.8.
- Type
(label: any, payload: TooltipPayload) → React.ReactNode- Parameters
label– anypayload– TooltipPayload- Returns
React.ReactNode
labelKey?string
The key in the data to read the label from, looked up in config.
nameKey?string
The key in each item's data to look its name up by in config.
className?string
Merged with the part's classes.
Related
Chart Tooltip without Indicator
TooltipsA tooltip with no color indicator beside the series.
Chart Tooltip with Formatter
TooltipsA tooltip whose values carry their own units.
Chart Tooltip
TooltipsThe default tooltip: a label, then each series with its dot.
Pie Chart
Pie chartsA plain pie, one slice per browser.
Radial Chart
Radial chartsOne ring per browser, each as long as its share.
A tooltip that marks each series with a line, not a dot.