Tooltip
overview
Tooltip is the stable styled modal-overlay primitive. Behavior is owned by `@uifn/core`; framework packages adapt that behavior and the styled packages add public parts and tokens. Implementation kind: `interactive-controller`.
anatomy
| Part | Public export | Native basis | Cardinality | Required value | React props | Svelte props | Solid props | |---|---|---|---|---|---|---|---| | `root` | `TooltipRoot` | `span` | one | — | `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `trigger` | `TooltipTrigger` | `button` | one | — | `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `positioner` | `TooltipPositioner` | `div` | one | — | `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `content` | `TooltipContent` | `div` | one | — | `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `arrow` | `TooltipArrow` | `div` | one | — | `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` |
state-actions-parts
Controller and context ownership:
- Core: `@uifn/core/tooltip: createTooltipController(props, environment?)`
- State: `TooltipState`
- Actions: `TooltipActions`
- Parts: `TooltipController["parts"]`
- DOM owner: @uifn/dom owns root-scope-modality-tabbability, dismissable-layer, positioning-auto-update, portal-presence-transitions
- react context: `TooltipProvider and useTooltip(inputs); adapter context remains private`
- svelte context: `TooltipProvider; adapter context remains private to compound descendants`
- solid context: `TooltipProvider; adapter context remains private to compound descendants`
States:
- `closed` (semantic)
- `opening-delay` (semantic)
- `open` (semantic)
- `closing-delay` (semantic)
Complete transition signatures:
- `{ type: "POINTER_ENTER" }` — Tooltip semantic transition event POINTER_ENTER. Source: controller-or-native-contract.
- `{ type: "POINTER_LEAVE" }` — Tooltip semantic transition event POINTER_LEAVE. Source: controller-or-native-contract.
- `{ type: "FOCUS" }` — Tooltip semantic transition event FOCUS. Source: controller-or-native-contract.
- `{ type: "BLUR" }` — Tooltip semantic transition event BLUR. Source: controller-or-native-contract.
- `{ type: "OPEN"; reason?: string }` — Tooltip semantic transition event OPEN. Source: controller-or-native-contract.
- `{ type: "CLOSE"; reason?: string }` — Tooltip semantic transition event CLOSE. Source: controller-or-native-contract.
- `{ type: "ESCAPE" }` — Tooltip semantic transition event ESCAPE. Source: controller-or-native-contract.
Controlled callbacks:
- `onOpenChange(value: boolean) => void` — Called after Tooltip requests a open change. Controlled consumers must commit the value back through open.
Root inputs and defaults:
| Input | Type | Required | Reactive | Default | Description |
|---|---|---:|---:|---|---|
| `open` | `boolean` | no | yes | `undefined → false` | Optional reactive open input from the canonical Tooltip contract. |
| `defaultOpen` | `boolean` | no | yes | `undefined → false` | Optional reactive defaultOpen input from the canonical Tooltip contract. |
| `openDelay` | `number` | no | yes | `undefined (no public prop override)` | Optional reactive openDelay input from the canonical Tooltip contract. |
| `closeDelay` | `number` | no | yes | `undefined (no public prop override)` | Optional reactive closeDelay input from the canonical Tooltip contract. |
| `placement` | `string` | no | yes | `undefined (no public prop override)` | Optional reactive placement input from the canonical Tooltip contract. |
| `disabled` | `boolean` | no | yes | `undefined → false` | Optional reactive disabled input from the canonical Tooltip contract. |controlled-uncontrolled
Control mode: `single`. Controlled inputs: `open`. Uncontrolled defaults: `defaultOpen`. Change events: `OPEN_CHANGE`. Do not switch mode after mount.
accessibility
Profile: `modal-overlay`. Native semantic basis: Use dialog or tooltip semantics appropriate to the primitive and never apply one generic overlay role. Accessible name required: yes; accepted sources: title-part, aria-label, aria-labelledby. WCAG mapping: 1.3.1, 1.4.13, 2.1.1, 2.1.2, 2.4.3, 2.4.7, 2.4.11, 4.1.2. Normative basis: native-html, wai-aria-apg-dialog-modal, wai-aria-apg-tooltip. Final manual accessibility review remains outstanding. Automated and current manual evidence does not include JAWS, which remains explicitly user-deferred.
keyboard-pointer-touch
Keyboard model: `overlay-specific`; keys: `Tab`, `Shift+Tab`, `Escape`, `Enter`, `Space`. Pointer/touch obligations: trigger-activation, outside-interaction-by-declared-policy, touch-cancellation. Focus obligations: initial-focus, containment-when-modal, restore-focus, nested-scope-arbitration.
forms
Participation: `none`; value shape: `none`; reset: `none`; validation: `none`.
direction-locale
RTL contract: Declare logical versus physical direction behavior and mirror only directional semantics. Direction is supplied through DOM `dir`; locale-sensitive labels and formatting stay application-owned unless a primitive input says otherwise.
ssr-hydration
The controller is deterministic and DOM access is adapter-owned. Render the same controlled/default inputs on server and first client render. Portal, presence, root-scope, modality, and tabbability services (root-scope-modality-tabbability, dismissable-layer, positioning-auto-update, portal-presence-transitions) activate only after the DOM is available.
composition-styling
Use the compound root `Tooltip` or named parts shown above. Import `@uifn/components/styles.css` once, then override tokens or low-specificity part selectors in a later CSS layer. Stable data attributes: - `data-uifn-component="tooltip"` on all styled parts; stable. - `data-uifn-part="root | trigger | positioner | content | arrow"` on all styled parts; stable. - `data-state="closed | opening-delay | open | closing-delay"` on stateful parts; stable semantic state. - `data-disabled="true | false"` on parts whose semantics depend on this input; stable semantic state. CSS variables: - `--uifn-component-accent` (shared) - `--uifn-component-accent-contrast` (shared) - `--uifn-component-bg` (shared) - `--uifn-component-bg-muted` (shared) - `--uifn-component-border` (shared) - `--uifn-component-border-strong` (shared) - `--uifn-component-danger` (shared) - `--uifn-component-fg` (shared) - `--uifn-component-fg-muted` (shared) - `--uifn-component-radius-lg` (shared) - `--uifn-component-radius-md` (shared) - `--uifn-component-radius-sm` (shared) - `--uifn-component-shadow` (shared) - `--uifn-control-block-size` (shared) - `--uifn-control-gap` (shared)
package-install
Published package version: `0.0.1`; canonical catalog version: `stable-1.0`.
| Framework | Public import | Source-install target |
|---|---|---|
| react | `@uifn/components-react/tooltip` | `components/uifn/react/tooltip.ts` |
| svelte | `@uifn/components-svelte/tooltip` | `components/uifn/svelte/tooltip/index.ts` |
| solid | `@uifn/components-solid/tooltip` | `components/uifn/solid/tooltip.ts` |
#### React · package
```tsx
import * as React from 'react';
import { TooltipRoot } from "@uifn/components-react/tooltip";
export function TooltipExample() {
return React.createElement(TooltipRoot, {});
}
```
#### React · source
```tsx
import * as React from 'react';
import { TooltipRoot } from "./components/uifn/react/tooltip.js";
export function TooltipExample() {
return React.createElement(TooltipRoot, {});
}
```
#### Svelte · package
```svelte
<script lang="ts">
import { TooltipRoot } from "@uifn/components-svelte/tooltip";
</script>
<TooltipRoot />
```
#### Svelte · source
```svelte
<script lang="ts">
import { TooltipRoot } from "./components/uifn/svelte/tooltip/index.js";
</script>
<TooltipRoot />
```
#### Solid · package
```tsx
import { createComponent } from 'solid-js';
import { TooltipRoot } from "@uifn/components-solid/tooltip";
export function TooltipExample() {
return createComponent(TooltipRoot, {});
}
```
#### Solid · source
```tsx
import { createComponent } from 'solid-js';
import { TooltipRoot } from "./components/uifn/solid/tooltip.js";
export function TooltipExample() {
return createComponent(TooltipRoot, {});
}
```source-install
Use `uifn add tooltip --framework <react|svelte|solid>` through `@uifn/registry`. The lockfile records the catalog, generator, template, and output hashes. Source-install files have the same public component contract as package delivery; edit intentionally and let `uifn diff` report local divergence.
known-constraints
Required release channel: `stable-1.0`. Catalog status: `ga-required`. Compatibility certification is still pending external runner/device-lab evidence; this page documents current generated compatibility evidence and is not a complete release certification. Declared exceptions: none. Explicit limitations: - Controller state and actions are framework-neutral; focus, layers, portals, positioning, presence, and native form bridges activate through @uifn/dom after mount. - Content supplies a description relationship and never replaces the trigger accessible name by accident.