Overlays

Tooltip

Hovered or focused text overlay. Wrap roots in <TooltipProvider>.

Preview
01 Installation

Install

Pull Tooltip from the barrel for everyday use, or the granular path when you want a tighter bundle.

tsxBarrel1 line
import { Tooltip } from "@brika/clay";
tsxGranular1 line
import { Tooltip } from "@brika/clay/components/tooltip";
02 Usage

A minimal example

Drop this into a page. Native HTML attributes pass through to the underlying primitive.

tsxTooltip.tsx20 lines
import { Button } from '@brika/clay/components/button';
import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from '@brika/clay/components/tooltip';
/** Wrap any element with TooltipTrigger inside a TooltipProvider to add a tooltip. */
export default function TooltipDefaultDemo() {
  return (
    <TooltipProvider>
      <Tooltip>
        <TooltipTrigger asChild>
          <Button variant="outline">Save draft</Button>
        </TooltipTrigger>
        <TooltipContent>Saves without publishing</TooltipContent>
      </Tooltip>
    </TooltipProvider>
  );
}
03 Examples

Tooltip, every way

Delay

Control open delay with delayDuration on the provider, 0 makes it instant.

Disabled Element

Disabled buttons don't fire pointer or focus events, so tooltips never trigger. Use `aria-disabled` instead — the button stays focusable and keyboard-reachable, the tooltip works, and the click handler guards against the disabled action.

Sides

Side and sideOffset control where the tooltip appears relative to its trigger.

04 Accessibility

Accessibility

  • Tooltips open on both hover and keyboard focus, use for supplementary info, not required instructions.
  • Never place interactive elements inside a TooltipContent, use Popover instead.
  • delayDuration={0} on the provider makes tooltips instant, which helps keyboard-only users.
  • Wrap disabled buttons in a focusable <span tabIndex={0}> so the tooltip fires on focus.
05 Tokens 18 theme-overridable

Theme tokens

Every CSS variable Tooltip reads, with its default and the dotted path you'd write in a ThemeConfig JSON to override it. Set any of these in your theme to retune Tooltip without touching component code.

Tooltip tokens

18 tokens
ColorFill, border, and text colors.3
  • --tooltip-surface-containercolorvar(--foreground)
    components.tooltip.surfaceContainer

    Background of the tooltip body. Defaults to the inverted page foreground for the conventional dark-on-light tooltip.

  • --tooltip-surface-labelcolorvar(--background)
    components.tooltip.surfaceLabel

    Foreground color of the tooltip body. Defaults to the inverted page background.

  • --tooltip-arrow-colorcolorvar(--foreground)
    components.tooltip.arrowColor

    Fill of the small arrow that points from the tooltip body towards the trigger. Override jointly with `surface-container` to keep the arrow flush.

GeometrySizes, lengths, and corner radii.3
  • --tooltip-radiusradiusvar(--radius-control)
    components.tooltip.radius

    Tooltip corner radius.

  • --tooltip-padding-xsizecalc(var(--spacing) * 2)
    components.tooltip.paddingX

    Inline padding inside the tooltip.

  • --tooltip-padding-ysizecalc(var(--spacing) * 1)
    components.tooltip.paddingY

    Block padding inside the tooltip.

BorderBorder width and style.2
  • --tooltip-border-widthborder-width0px
    components.tooltip.borderWidth

    Border width on the tooltip. Set non-zero for outline-style variants.

  • --tooltip-border-styleborder-stylesolid
    components.tooltip.borderStyle

    Border style on the tooltip (`solid`, `dashed`, `double`, `none`).

TypographyTypeface, size, weight, spacing.6
  • --tooltip-font-familyfont-familyvar(--font-sans)
    components.tooltip.fontFamily

    Typeface for tooltip.

  • --tooltip-font-sizefont-sizevar(--text-label-md)
    components.tooltip.fontSize

    Font size for tooltip.

  • --tooltip-font-weightfont-weight500
    components.tooltip.fontWeight

    Font weight for tooltip.

  • --tooltip-line-heightline-height1.25
    components.tooltip.lineHeight

    Line height for tooltip.

  • --tooltip-letter-spacingletter-spacing0
    components.tooltip.letterSpacing

    Letter spacing for tooltip. Useful for caps labels.

  • --tooltip-text-transformtext-transformnone
    components.tooltip.textTransform

    Text transform for tooltip (`uppercase`, `lowercase`, `capitalize`, `none`).

ElevationDrop shadow and depth.2
  • --tooltip-shadowshadowvar(--shadow-overlay)
    components.tooltip.shadow

    Tooltip elevation.

  • --tooltip-backdrop-blurblur0px
    components.tooltip.backdropBlur

    Backdrop blur on the tooltip. Set non-zero for a frosted-glass tooltip.

MotionAnimation duration and easing.2
  • --tooltip-durationdurationvar(--motion-standard-duration)
    components.tooltip.duration

    Transition duration for tooltip state changes.

  • --tooltip-easingeasingvar(--motion-standard-easing)
    components.tooltip.easing

    Transition easing for tooltip state changes.

Override in a theme

Authoring a theme is plain JSON. Drop overrides under components.tooltip, the names are camelCase versions of the variable suffix.

jsonmy-theme.json12 lines
{
  "id": "my-theme",
  "name": "My Theme",
  "description": "...",
  "accentSwatches": ["#000"],

  "components": {
    "tooltip": {
      "paddingX": "calc(var(--spacing) * 2)"
    }
  }
}

Then apply with applyTheme(myTheme) (see the theming guide), scope it to a subtree with themeToCssVars(myTheme, mode), or consume any token directly in your own JSX with the matching Tailwind utility (e.g. bg-tooltip-…) — see the chips on each token row.

06 API reference

API reference

Props specific to Tooltip. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.

<Tooltip />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<TooltipContent />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<TooltipProvider />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.

<TooltipTrigger />

passthrough

No wrapper-specific props, all attributes pass through to the underlying primitive.