# Tooltip

Short contextual labels on hover or keyboard focus.

Access: pro. Category: Feedback. Kind: primitive.

## When to use

- Use it when a product interface needs short contextual labels on hover or keyboard focus.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose alert instead when inline notices with icons, actions and optional dismissal is the actual interface need, rather than tooltip.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Tooltip

```sh
npx shadcn@latest add @tidal-pro/tooltip
```

Stylesheets: `components/ui/tidal.css`, `components/ui/tooltip.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/tooltip.css";
import{TidalTooltip}from"./components/ui/tooltip";
export default()=><div className="tidal-scope"><TidalTooltip children={<button type="button">Demo</button>} content={"value"}/></div>;
```

## Structured props

- `TidalTooltipProvider.children: ReactNode`: Required children value accepted by this exported component.
- `TidalTooltipProvider.delayDuration?: number | undefined` (default 350): Optional delay duration value accepted by this exported component.
- `TidalTooltipProvider.skipDelayDuration?: number | undefined` (default 300): Optional skip delay duration value accepted by this exported component.
- `TidalTooltip.children: ReactElement<unknown, string | JSXElementConstructor<any>>`: Required children value accepted by this exported component.
- `TidalTooltip.content: string`: Required content value accepted by this exported component.
- `TidalTooltip.align?: "center" | "start" | "end" | undefined` (default "center"): Optional align value accepted by this exported component.
- `TidalTooltip.className?: string | undefined` (default ""): Optional class name value accepted by this exported component.
- `TidalTooltip.delayDuration?: number | undefined` (default 350): Optional delay duration value accepted by this exported component.
- `TidalTooltip.shortcut?: string | undefined`: Optional visual key hint. The consumer is responsible for its behavior.
- `TidalTooltip.side?: "top" | "bottom" | "left" | "right" | undefined` (default "top"): Optional side value accepted by this exported component.
- `TidalTooltip.theme?: "light" | "dark" | undefined` (default "light"): Optional theme value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/tooltip.tsx) | [Manifest](https://tidalui.com/examples/tooltip.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { TidalTooltip, TidalTooltipProvider } from "./components/ui/tooltip";

import "./components/ui/tooltip.css";

import { Share2, Download } from "lucide-react";

import { LayoutGrid, Folder } from "lucide-react";

import { useState, useId } from "react";

import { TidalButton } from "./components/ui/tidal-button";



const tidalExampleStyles = ".demo-eyebrow{font-size:11px;letter-spacing:1px;color:var(--t-muted);font-weight:500;margin:0 0 13px}\n\n.tooltip-specimen{width:100%;max-width:370px;background:var(--t-surface);border:1px solid var(--t-border);border-radius:17px;padding:28px;text-align:center;box-shadow:0 8px 24px #1f1f1f07}.tooltip-specimen>.demo-eyebrow{font-size:11px}.tooltip-specimen>h3{font-size:23px;letter-spacing:-.8px;color:var(--t-ink);margin:12px 0 23px}.tooltip-demo-tools{display:flex;justify-content:center;gap:10px}.tooltip-demo-tools .tidal-button{width:44px;padding:0;border-radius:10px}.tooltip-demo-status{font-size:11px;color:var(--t-muted);margin:22px 0 0;line-height:1.6}.tooltip-demo-note{font-size:11px;color:var(--t-muted);margin:8px 0 0}\n.tooltip-specimen{max-width:580px;padding:28px;text-align:left;border-radius:var(--t-radius-card);box-shadow:0 24px 40px -28px #00000035,0 2px 4px #00000008}.tooltip-demo-heading>h3{font-size:26px;letter-spacing:-.9px;line-height:1.2;margin:13px 0 24px}.tooltip-demo-document{border:1px solid var(--t-border);border-radius:12px;padding:20px;background:linear-gradient(145deg,var(--t-subtle),var(--t-surface));box-shadow:0 2px 3px #00000005;transition:padding 420ms var(--t-ease-out)}.tooltip-demo-document-top{display:flex;align-items:center;justify-content:space-between;gap:10px;color:var(--t-muted);font-size:11px;letter-spacing:1px}.tooltip-demo-document-top>span:first-child{display:flex;align-items:center;gap:7px}.tooltip-demo-document>h4{font-family:\"Instrument Serif\",serif;font-style:italic;font-size:29px;line-height:1.15;letter-spacing:-.5px;font-weight:400;margin:20px 0 12px;color:var(--t-ink);transition:margin 420ms var(--t-ease-out)}.tooltip-demo-document>p{font-size:11px;line-height:1.8;margin:0;color:var(--t-muted);max-width:380px}.tooltip-demo-document-lines{display:flex;flex-direction:column;gap:7px;margin:19px 0 21px}.tooltip-demo-document-lines>span{height:3px;border-radius:2px;background:var(--t-border);width:88%;transition:width 420ms var(--t-ease-out),margin 420ms var(--t-ease-out)}.tooltip-demo-document-lines>span:nth-child(2){width:72%}.tooltip-demo-document-lines>span:last-child{width:48%}.tooltip-demo-document[data-roomy=true]{padding-block:28px}.tooltip-demo-document[data-roomy=true]>h4{margin-top:28px;margin-bottom:18px}.tooltip-demo-document[data-roomy=true] .tooltip-demo-document-lines>span{width:95%;margin-block:2px}.tooltip-demo-document[data-roomy=true] .tooltip-demo-document-lines>span:nth-child(2){width:82%}.tooltip-demo-document[data-roomy=true] .tooltip-demo-document-lines>span:last-child{width:62%}.tooltip-demo-document-bottom{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--t-muted);border-top:1px solid var(--t-border);padding-top:12px}.tooltip-demo-document-bottom>span:last-child{margin-left:auto}.tooltip-demo-document-avatar{display:grid;place-items:center;width:24px;height:24px;border-radius:6px;background:var(--t-ink);color:var(--t-surface);font-size:11px}.tooltip-demo-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:18px}.tooltip-demo-toolbar>span{font-size:11px;letter-spacing:1px;color:var(--t-muted)}.tooltip-demo-tools{gap:7px}.tooltip-demo-tools .tidal-button[aria-pressed=true],.tooltip-demo-tools .tidal-button[aria-expanded=true]{background:var(--t-ink);color:var(--t-surface);border-color:var(--t-ink)}.tooltip-demo-sharing{display:grid;grid-template-rows:0fr;transition:grid-template-rows 420ms var(--t-ease-out)}.tooltip-demo-sharing[data-open=true]{grid-template-rows:1fr}.tooltip-demo-sharing>div{overflow:hidden;min-height:0}.tooltip-demo-sharing section{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:19px 7px 7px}.tooltip-demo-sharing .demo-eyebrow{width:100%;font-size:11px}.tooltip-demo-sharing code{font-size:11px;color:var(--t-muted);overflow-wrap:anywhere;flex:1}.tooltip-demo-sharing .tidal-button{font-size:11px;flex:none}.tooltip-demo-status{margin-top:19px;font-size:11px;min-height:16px;line-height:1.6;color:var(--t-muted)}.tooltip-demo-note{font-size:11px;margin-top:5px;color:var(--t-muted)}@media(max-width:420px){.tooltip-specimen{padding:22px}.tooltip-demo-heading>h3{font-size:23px}.tooltip-demo-document{padding:16px}.tooltip-demo-document>h4{font-size:26px}.tooltip-demo-toolbar>span{font-size:11px;max-width:90px;line-height:1.8}.tooltip-demo-sharing code{font-size:11px}.tooltip-demo-sharing .tidal-button{padding-inline:12px}}";

export function TooltipDemo({
  theme = "light",
  writeText,
}: {
  theme?: "light" | "dark";
  writeText?: (text: string) => Promise<void>;
}) {
  const [action, setAction] = useState("Hover or focus a control.");
  const [roomy, setRoomy] = useState(false);
  const [sharing, setSharing] = useState(false);
  const shareId = useId();
  async function copyLink() {
    try {
      const url = new URL("/sample-project-brief.txt", window.location.href)
        .href;
      await (writeText ? writeText(url) : navigator.clipboard.writeText(url));
      setAction("Sample document link copied.");
    } catch {
      setAction(
        "Copy unavailable. The sample file is at /sample-project-brief.txt.",
      );
    }
  }
  return (
    <TidalTooltipProvider>
      <div className="tooltip-specimen" data-sharing={sharing}>
        <div className="tooltip-demo-heading"></div>
        <article
          className="tooltip-demo-document"
          data-roomy={roomy}
          aria-label="Sample project brief"
        >
          <div className="tooltip-demo-document-top">
            <span>
              <Folder size={13} aria-hidden="true" /> NORTHSTAR
            </span>
            <span>SAMPLE .TXT</span>
          </div>
          <h4>Project brief</h4>
          <p>Goals, scope and milestones for the sample project.</p>
          <div className="tooltip-demo-document-lines" aria-hidden="true">
            <span />
            <span />
            <span />
          </div>
          <div className="tooltip-demo-document-bottom">
            <span className="tooltip-demo-document-avatar" aria-hidden="true">
              NS
            </span>
            <span>Original sample content</span>
            <span>{roomy ? "Roomy" : "Compact"}</span>
          </div>
        </article>
        <div className="tooltip-demo-toolbar">
          <span>DOCUMENT ACTIONS</span>
          <div
            className="tooltip-demo-tools"
            role="group"
            aria-label="Sample document actions"
          >
            <TidalTooltip
              content="Show the sample document link."
              shortcut="Enter"
              theme={theme}
            >
              <TidalButton
                variant="secondary"
                aria-label="Show sample link"
                aria-expanded={sharing}
                aria-controls={shareId}
                onClick={() => {
                  setSharing(!sharing);
                  setAction(
                    sharing
                      ? "Sample link hidden."
                      : "Copy the sample link below.",
                  );
                }}
              >
                <Share2 size={17} aria-hidden="true" />
              </TidalButton>
            </TidalTooltip>
            <TidalTooltip
              content="Download the fictional project brief."
              shortcut="Enter"
              theme={theme}
            >
              <a
                className="tidal-button tidal-button-secondary"
                href="/sample-project-brief.txt"
                download
                aria-label="Download sample document"
                onClick={() => setAction("Sample document download requested.")}
              >
                <Download size={17} aria-hidden="true" />
              </a>
            </TidalTooltip>
            <TidalTooltip
              content={
                roomy
                  ? "Use compact document spacing."
                  : "Give the document more room."
              }
              shortcut="Enter"
              theme={theme}
            >
              <TidalButton
                variant="secondary"
                aria-label="Toggle document spacing"
                aria-pressed={roomy}
                onClick={() => {
                  setRoomy(!roomy);
                  setAction(
                    roomy
                      ? "Compact document spacing."
                      : "Roomy document spacing.",
                  );
                }}
              >
                <LayoutGrid size={17} aria-hidden="true" />
              </TidalButton>
            </TidalTooltip>
          </div>
        </div>
        <div
          className="tooltip-demo-sharing"
          id={shareId}
          data-open={sharing}
          aria-hidden={!sharing}
          inert={!sharing}
        >
          <div>
            <section>
              <span className="demo-eyebrow">SAMPLE DOCUMENT LINK</span>
              <code>/sample-project-brief.txt</code>
              <TidalButton variant="secondary" onClick={copyLink}>
                Copy sample link <Share2 size={14} aria-hidden="true" />
              </TidalButton>
            </section>
          </div>
        </div>
        <p className="tooltip-demo-status" role="status">
          {action}
        </p>
        <p className="tooltip-demo-note">Hover or focus a control.</p>
      </div>
    </TidalTooltipProvider>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <TooltipDemo />
    </div>
  );
}

```

## Gotchas

- Install the declared registry dependencies and render inside a tidal-scope with the foundation stylesheet loaded.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Wrap the app in exported TidalTooltipProvider (delayDuration350ms, skipDelayDuration300ms defaults). TidalTooltip requires short content:string and one enabled focusable child forwarding props/ref. Optional side, align, theme, delayDuration, shortcut (decorative key hint; consumer implements behavior) and className(content). Direction-aware surface entrance and staggered text/key reveal. Radix hover/focus description, Escape dismissal, hoverable content and collision positioning. Tooltip supplements the child accessible name; keep essential instructions visible and don't put actions in the tooltip. Pass theme for portal palette.
