Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Overlays & Actions

Tooltip

A modern popup label that appears on hover or keyboard focus. Reveal the right amount of context without losing the user's place in the interface. Keep the trigger, content and dismissal behavior working as one interaction. Import it from @/components/kamod-ui/tooltip.

Source · Design reference · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Import TooltipProvider, Tooltip, TooltipTrigger and TooltipContent from @/components/kamod-ui/tooltip.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Usage

Keep tooltip copy short, support keyboard focus, and never hide critical actions behind only tooltip text.

Import SetupTypeScript
import { Tooltip } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Component Examples & Variants

Explore Tooltip in Different Contexts, from the starting pattern to the compositions below. Begin with Basic, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Basic

Add a Brief Explanation, Not Hidden Instructions. Pair a tooltip trigger with a brief explanation that appears on hover or keyboard focus. Use it for supplemental help around an already understandable control, keeping essential task instructions visible in the main interface.

Keep essential information visible elsewhere and avoid placing actions or long content inside a surface intended for short hints.

src/components/TooltipExample.tsx12 lines
import { Button, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@kamod-ch/ui";

export const Example = () => (
  <TooltipProvider>
    <Tooltip>
      <TooltipTrigger>
        <Button variant="outline">Hover</Button>
      </TooltipTrigger>
      <TooltipContent>Add to library</TooltipContent>
    </Tooltip>
  </TooltipProvider>
);

Side

Choose a Preferred Side that Leaves Room to Read. Choose the tooltip's side from top, right, bottom or left according to the trigger's location. Compare the same hint at each edge so the preferred placement leaves room without obscuring the control it explains.

Test near viewport edges and in dense toolbars, and keep the tooltip short enough that its position does not become a layout problem.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Align and Offset

Use Offsets to Refine a Clear Relationship. Use alignment and position offsets to fine-tune the tooltip's relationship to its trigger. These adjustments are useful near edges or grouped controls, where a centered popup may compete with neighboring content.

Check real text lengths and narrow containers before adding special-case positions for individual buttons.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Provider Delay

Keep Timing Consistent within a Control Area. Set shared tooltip timing through the provider when a toolbar or region should use one consistent delay. This avoids configuring every hint independently while allowing the opening behavior to suit the density of the surrounding controls.

Balance quick discovery with accidental activation, and preserve keyboard focus behavior independently of pointer timing; longer delays should not hide essential explanations.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Disable Hoverable Content

Use This for Short, Non-Interactive Hints. Use the non-hoverable content option when leaving the trigger should dismiss a brief passive hint immediately. Keep that content nonessential and noninteractive, since users are not being given time to move into it.

Keep the text brief and choose Popover when users need to move into the panel or interact with its contents.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

With Keyboard Shortcut

Pair the Action Name with an Accurate Key Hint. Include a compact keyboard hint alongside the tooltip's action name when the application supports that command. The visible key sequence documents a real shortcut, rather than adding keyboard behavior to the trigger automatically.

Keep the trigger usable without the shortcut and ensure platform-specific modifiers match the behavior users actually receive.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Disabled Button

Explain the Restriction without Enabling the Action. Wrap a disabled button with a suitable tooltip trigger because the disabled control may not receive the necessary events. Give the wrapper appropriate focus behavior so the reason for the restriction is available beyond pointer hover.

Keep the reason concise, test both pointer and keyboard access, and put important prerequisites in persistent text when the tooltip would otherwise be the only way to discover them.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Tooltip using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Props, slots and variants for this component.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
@kamod-ch/ui/tooltip18.6 KB min · 4.7 KB gzipSignals: direct@preact/signals

Tooltip

TooltipProps

Tooltip documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildTooltipProps

Configure children for Tooltip. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
closeDelayDuration
numberTooltipProps

Configure closeDelayDuration for Tooltip. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
defaultOpen
booleanTooltipProps

Configure defaultOpen for Tooltip. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
delayDuration
numberTooltipProps

Configure delayDuration for Tooltip. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
disableHoverableContent
booleanTooltipProps

Configure disableHoverableContent for Tooltip. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onOpenChange
((next: boolean) => void)TooltipProps

Configure onOpenChange for Tooltip. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
open
booleanTooltipProps

Configure open for Tooltip. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

TooltipContent

TooltipContentProps

TooltipContent documented props
Prop / typeDescription
align
"start" | "center" | "end"TooltipContentProps

Configure align for TooltipContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"center"
alignOffset
numberTooltipContentProps

Configure alignOffset for TooltipContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
0
asChild
booleanTooltipContentProps

Configure asChild for TooltipContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
children
ComponentChild[] | ComponentChildTooltipContentProps

Configure children for TooltipContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
collisionPadding
numberTooltipContentProps

Configure collisionPadding for TooltipContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
8
forceMount
booleanTooltipContentProps

Configure forceMount for TooltipContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
side
"bottom" | "top" | "right" | "left"TooltipContentProps

Configure side for TooltipContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"top"
sideOffset
numberTooltipContentProps

Configure sideOffset for TooltipContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
8

TooltipProvider

TooltipProviderProps

TooltipProvider documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildTooltipProviderProps

Configure children for TooltipProvider. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
closeDelayDuration
numberTooltipProviderProps

Configure closeDelayDuration for TooltipProvider. Compare its accepted type with the Usage Guidance before supplying a value.

Default
120
delayDuration
numberTooltipProviderProps

Configure delayDuration for TooltipProvider. Compare its accepted type with the Usage Guidance before supplying a value.

Default
250
disableHoverableContent
booleanTooltipProviderProps

Configure disableHoverableContent for TooltipProvider. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false

TooltipTrigger

TooltipTriggerProps

TooltipTrigger documented props
Prop / typeDescription
asChild
booleanTooltipTriggerProps

Configure asChild for TooltipTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
children
ComponentChild[] | ComponentChildTooltipTriggerProps

Configure children for TooltipTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

Tooltip Props

7 declared fields
TooltipProps
Exported Source Declaration from Tooltip.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TooltipProps before adapting it.

TooltipProvider Props

4 declared fields
TooltipProviderProps
Exported Source Declaration from Tooltip.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TooltipProviderProps before adapting it.

TooltipContent Props

8 declared fields
TooltipContentProps
Exported Source Declaration from TooltipContent.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TooltipContentProps before adapting it.

TooltipContentCommon Props

5 declared fields
TooltipContentCommonProps
Local Source Declaration from TooltipContent.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TooltipContentCommonProps before adapting it.

TooltipTrigger Props

2 declared fields
TooltipTriggerProps
Exported Source Declaration from TooltipTrigger.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of TooltipTriggerProps before adapting it.

Accessibility

Build the Complete Interaction, Including the Parts Outside Tooltip. The notes below distinguish the current implementation from the labels, content and behavior your application supplies. Start with the Live Preview, check the Props and Data Reference, and test the finished composition with real content rather than assuming that an unchanged visual example covers every use case.

Built-in Behavior and Defaults

TooltipTrigger connects visible tooltip content through aria-describedby. It opens on focus and supports Escape dismissal through Tooltip. The default trigger is a focusable span; asChild lets an existing control serve as the trigger instead.

Labels and Relationships

Give the underlying control its own accessible name; the tooltip should add a short explanation. Prefer asChild around an existing named button to avoid an unnecessary extra tab stop. Keep essential instructions visible elsewhere.

Keyboard and Focus

Test focus, pointer hover, blur and Escape. Do not put buttons, links or required form controls inside tooltip content; interactive information belongs in a popover or another persistent surface.

States and Integration Details

When customizing descriptions, inspect the final aria-describedby value: the visible tooltip's ID can replace a supplied description relationship. Do not assume tooltip content is available on touch devices or that it can be the only label for an icon.

Verify the Complete Interaction

Check Behavior as Well as Markup. Work through these scenarios in the application where the component will be used. Automated checks can help find structural problems; also review the reading experience with a screen reader, keyboard focus and the actual feedback from your application.

  1. Focus the control and confirm both its independent name and optional help are understandable.
  2. Dismiss with Escape and move focus away without leaving an orphaned tooltip.
  3. Use the interface with touch and with tooltips unavailable; essential tasks must remain clear.

Recheck the result after changing Theme Tokens, translations or class overrides. Include text enlargement, narrow layouts and reduced-motion settings where animation is present. Inspect the Component Source when a behavior differs from your expectation; a role or state attribute does not implement keyboard interaction by itself.

For background, read the WAI-ARIA Authoring Guidance and Keyboard Interface Guidance. These explain the patterns; verify browser and assistive-technology behavior for the implementation and audience you actually support.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.