# Tooltip

A short hint that appears on hover and keyboard focus.

- **Use it for**: A short label for an icon or truncated text, on hover and focus.
- **Not for**: Anything interactive or essential; touch users may never see it. Try [Popover](https://unseenui.com/components/popover/).

## Installation

```bash
npm install @stackunseen/ui
```

## Parts

Short help text on hover and keyboard focus. Nothing inside it can be clicked; use Popover for that.

```tsx
<Tooltip>
  <Tooltip.Trigger asChild>
    <Button variant="outline">Read-only preview</Button>
  </Tooltip.Trigger>
  <Tooltip.Content>Changes are kept in this local example.</Tooltip.Content>
</Tooltip>
```

1. **`TooltipProvider`**: Optional; shares the hover delay across tooltips.
2. **`Tooltip`**: Holds the open state.
3. **`Tooltip.Trigger`**: The control it describes. Pass your own with `asChild`.
4. **`Tooltip.Content`**: The text. Props: `container`.
5. **`Tooltip.Arrow`**: An optional pointer.

## Usage

```tsx
import { Tooltip } from '@stackunseen/ui';
import { Button } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<Tooltip><Tooltip.Trigger asChild><Button variant="outline">Read-only preview</Button></Tooltip.Trigger><Tooltip.Content>Changes are kept in this local example.</Tooltip.Content></Tooltip>
```

## All props

| Prop | Type | Description |
| --- | --- | --- |
| `dir` | `"ltr" \| "rtl"` | Set for locally scoped RTL layouts so the portal and trigger share direction. |

## Keyboard

Focusing the trigger reveals the hint; Escape dismisses it without moving focus.

## Works with

[Popover](https://unseenui.com/components/popover/), [ShortcutHelp](https://unseenui.com/components/shortcut-help/), [AlertDialog](https://unseenui.com/components/alert-dialog/), [Modal](https://unseenui.com/components/modal/)

Page: https://unseenui.com/components/tooltip/
