Install
Pull Tooltip from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Tooltip } from "@brika/clay";import { Tooltip } from "@brika/clay/components/tooltip";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
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>
);
}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.
Accessibility
- Tooltips open on both hover and keyboard focus, use for supplementary info, not required instructions.
- Never place interactive elements inside a
TooltipContent, usePopoverinstead. -
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.
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--tooltip-surface-containercolorvar(--foreground)components.tooltip.surfaceContainerBackground of the tooltip body. Defaults to the inverted page foreground for the conventional dark-on-light tooltip.
--tooltip-surface-labelcolorvar(--background)components.tooltip.surfaceLabelForeground color of the tooltip body. Defaults to the inverted page background.
--tooltip-arrow-colorcolorvar(--foreground)components.tooltip.arrowColorFill of the small arrow that points from the tooltip body towards the trigger. Override jointly with `surface-container` to keep the arrow flush.
--tooltip-radiusradiusvar(--radius-control)components.tooltip.radiusTooltip corner radius.
--tooltip-padding-xsizecalc(var(--spacing) * 2)components.tooltip.paddingXInline padding inside the tooltip.
--tooltip-padding-ysizecalc(var(--spacing) * 1)components.tooltip.paddingYBlock padding inside the tooltip.
--tooltip-border-widthborder-width0pxcomponents.tooltip.borderWidthBorder width on the tooltip. Set non-zero for outline-style variants.
--tooltip-border-styleborder-stylesolidcomponents.tooltip.borderStyleBorder style on the tooltip (`solid`, `dashed`, `double`, `none`).
--tooltip-font-familyfont-familyvar(--font-sans)components.tooltip.fontFamilyTypeface for tooltip.
--tooltip-font-sizefont-sizevar(--text-label-md)components.tooltip.fontSizeFont size for tooltip.
--tooltip-font-weightfont-weight500components.tooltip.fontWeightFont weight for tooltip.
--tooltip-line-heightline-height1.25components.tooltip.lineHeightLine height for tooltip.
--tooltip-letter-spacingletter-spacing0components.tooltip.letterSpacingLetter spacing for tooltip. Useful for caps labels.
--tooltip-text-transformtext-transformnonecomponents.tooltip.textTransformText transform for tooltip (`uppercase`, `lowercase`, `capitalize`, `none`).
--tooltip-shadowshadowvar(--shadow-overlay)components.tooltip.shadowTooltip elevation.
--tooltip-backdrop-blurblur0pxcomponents.tooltip.backdropBlurBackdrop blur on the tooltip. Set non-zero for a frosted-glass tooltip.
--tooltip-durationdurationvar(--motion-standard-duration)components.tooltip.durationTransition duration for tooltip state changes.
--tooltip-easingeasingvar(--motion-standard-easing)components.tooltip.easingTransition 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.
{
"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.
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 />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TooltipContent />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TooltipProvider />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<TooltipTrigger />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.