Veil UI
Components

Chart Tooltip

The chart tooltip and its custom content renderer.

Installation

$ npx veil-ui@latest add chart-tooltip

Usage

import { ChartContainer, ChartTooltip } from "@/components/ui/chart";
// ChartTooltip is the styled Recharts tooltip used by every chart in this registry.
<ChartTooltip />;

Examples

Basic

Compact

API reference

The package exports chart-tooltip along with its composable parts. It forwards standard attributes to its root element; see the examples above for the component-specific props.

Accessibility

  • Charts render inside a container with an explicit height so they stay responsive without layout shift.
  • Color is never the only encoding; pair charts with labels, summaries or a data table for critical information.
  • Tooltips and legends are rendered as HTML, so their text is available to assistive technology.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add chart-tooltip --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { ChartTooltipContent } from "@/components/ui/chart";

defineProps<{
  active?: boolean;
  payload?: Array<{
    dataKey?: string | number;
    name?: string;
    value?: string | number;
    color?: string;
  }>;
  label?: string | number;
  hideLabel?: boolean;
}>();
</script>

<template>
  <ChartTooltipContent
    :active="active"
    :payload="payload"
    :label="label"
    :hide-label="hideLabel"
  />
</template>

On this page