Volt UI
Components

Tooltip

A tooltip that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.

Basic Usage

Wrap your trigger element with Tooltip, TooltipTrigger, and TooltipContent components.

import { Tooltip, TooltipTrigger, TooltipContent, Button } from "@epilot/volt-ui"

<TooltipProvider>
  <Tooltip>
    <TooltipTrigger asChild>
      <Button size="icon" variant="tertiary"><IconCopy /></Button>
    </TooltipTrigger>
    <TooltipContent>
      content
    </TooltipContent>
  </Tooltip>
</TooltipProvider>

Positioning

Control the tooltip position using the side prop on TooltipContent. Available positions are top, right, bottom, and left.

import { Tooltip, TooltipTrigger, TooltipContent, Button } from "@epilot/volt-ui"

<Tooltip>
  <TooltipTrigger asChild>
    <Button variant="secondary">Top</Button>
  </TooltipTrigger>
  <TooltipContent side="top">
    content
  </TooltipContent>
</Tooltip>

Variant

Control the visual style variant of the tooltip using the variant prop. Available variants are default and destructive.

import { Tooltip, TooltipTrigger, TooltipContent, Button } from "@epilot/volt-ui"

<Tooltip>
  <TooltipTrigger asChild>
    <Button size="icon" destructive><IconAlertTriangle /></Button>
  </TooltipTrigger>
  <TooltipContent variant="destructive">
    content
  </TooltipContent>
</Tooltip>

Custom Delay

Customize the delay duration before the tooltip appears by passing delayDuration directly to the Tooltip component.

import { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent, Button } from "@epilot/volt-ui"

<Tooltip delayDuration={2000}>
  <TooltipTrigger asChild>
    <Button variant="tertiary">Delayed tooltip</Button>
  </TooltipTrigger>
  <TooltipContent>
    <p>This tooltip appears after 2 seconds</p>
  </TooltipContent>
</Tooltip>

API Reference

Tooltip

The root component that wraps the tooltip trigger and content. Automatically includes a TooltipProvider.

PropTypeDefaultDescription
openboolean-Controlled open state of the tooltip.
defaultOpenbooleanfalseUncontrolled default open state.
onOpenChange(open: boolean) => void-Callback fired when the open state changes.
disabledbooleanfalseWhen true, prevents the tooltip from opening.
delayDurationnumber700The duration in milliseconds to wait before showing the tooltip.
variant"default" | "destructive""default"The visual style variant of the tooltip.

TooltipProvider

Provides context and global configuration for tooltips.

PropTypeDefaultDescription
delayDurationnumber700The duration in milliseconds to wait before showing the tooltip.
skipDelayDurationnumber0The duration in milliseconds to wait before hiding the tooltip.

TooltipTrigger

The element that triggers the tooltip. Use asChild to merge props with a child element.

PropTypeDefaultDescription
asChildbooleanfalseWhen true, merges props with the child element instead of rendering a button.

TooltipContent

The content container for the tooltip. Includes animations and an arrow indicator.

PropTypeDefaultDescription
side"top" | "right" | "bottom" | "left""top"The preferred side of the trigger to render against.
sideOffsetnumber2The distance in pixels from the trigger.
align"start" | "center" | "end""center"The preferred alignment against the trigger.
alignOffsetnumber0An offset in pixels from the "start" or "end" alignment options.
classNamestring-Additional CSS classes to apply to the tooltip content.
hideArrowboolean-Whether to hide the arrow indicator.