# Hover card

An informational profile preview with hover, keyboard focus and phone tap access, plus a persistent screen-reader description.

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

## When to use

- Use it when a product interface needs an informational profile preview with hover, keyboard focus and phone tap access, plus a persistent screen-reader description.
- 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 hover card.

## 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 Hover card

```sh
npx shadcn@latest add @tidal-pro/hover-card
```

Stylesheets: `components/ui/tidal.css`, `components/ui/hover-card.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/hover-card.css";
import{TidalHoverCard}from"./components/ui/hover-card";
export default()=><div className="tidal-scope"><TidalHoverCard accessibleDescription={"Demo"}/></div>;
```

## Structured props

- `TidalHoverCard.accessibleDescription: ReactNode`: Required accessible description value accepted by this exported component.
- `TidalHoverCard.defaultOpen?: boolean | undefined` (default false): Optional default open value accepted by this exported component.
- `TidalHoverCard.dir?: "ltr" | "rtl" | undefined` (default "ltr"): Optional dir value accepted by this exported component.
- `TidalHoverCard.onOpenChange?: ((open: boolean) => void) | undefined`: Callback invoked when the open change interaction is proposed.
- `TidalHoverCard.open?: boolean | undefined`: Optional open value accepted by this exported component.
- `TidalHoverCard.theme?: HoverCardTheme | undefined` (default "light"): Optional theme value accepted by this exported component.
- `TidalHoverCardContent.portalContainer?: HTMLElement | null | undefined`: Optional portal container value accepted by this exported component.
- `TidalHoverCardContent.showArrow?: boolean | undefined` (default true): Optional show arrow value accepted by this exported component.

## Complete usage example

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

```tsx
"use client";

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

import { useId, useState } from "react";

import { MapPin } from "lucide-react";

import { TidalHoverCard, TidalHoverCardContent, TidalHoverCardTrigger } from "./components/ui/hover-card";

import "./components/ui/hover-card.css";

function tidalExampleAvatarDataUri(seed: unknown) {
  const text = String(seed).replace(/[^a-z0-9]/gi, "").slice(-2) || "UI";
  const palette = ["#333333", "#555555", "#777777", "#999999", "#bbbbbb"];
  const color = palette[Array.from(text).reduce((sum, character) => sum + character.charCodeAt(0), 0) % palette.length];
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96"><rect width="96" height="96" rx="48" fill="${color}"/><circle cx="48" cy="38" r="17" fill="white" fill-opacity=".92"/><path d="M18 92c3-22 15-34 30-34s27 12 30 34" fill="white" fill-opacity=".92"/></svg>`;
  return `data:image/svg+xml,${encodeURIComponent(svg)}`;
}

function tidalExampleImageDataUri(label: string) {
  const safeLabel = label.replace(/[<>&]/g, "").slice(0, 28) || "Sample image";
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 675"><defs><linearGradient id="g" x1="0" x2="1" y1="0" y2="1"><stop stop-color="#171717"/><stop offset="1" stop-color="#555555"/></linearGradient></defs><rect width="1200" height="675" fill="url(#g)"/><circle cx="950" cy="100" r="260" fill="white" fill-opacity=".08"/><text x="80" y="570" fill="white" font-family="system-ui,sans-serif" font-size="64" font-weight="700">${safeLabel}</text></svg>`;
  return `data:image/svg+xml,${encodeURIComponent(svg)}`;
}

const tidalExampleStyles = ".tidal-scope .hover-card-demo,\n.tidal-scope .hover-card-demo * {\n  box-sizing: border-box;\n}\n\n.tidal-scope .hover-card-demo {\n  container: tidal-hover-demo / inline-size;\n  display: grid;\n  width: min(100%, 980px);\n  min-width: 0;\n  gap: 24px;\n  margin-inline: auto;\n  padding: clamp(16px, 4vw, 44px);\n  color: var(--t-ink);\n}\n\n.tidal-scope .hover-card-demo-heading {\n  display: grid;\n  max-width: 620px;\n  min-width: 0;\n  gap: 8px;\n}\n\n.tidal-scope .hover-card-demo-heading :is(h2, p) {\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .hover-card-demo-heading h2 {\n  font-size: clamp(27px, 5vw, 44px);\n  font-weight: 570;\n  letter-spacing: -0.052em;\n  line-height: 1;\n}\n\n.tidal-scope .hover-card-demo-heading p {\n  color: var(--t-muted);\n  font-size: 12px;\n  line-height: 1.55;\n}\n\n.tidal-scope .hover-card-demo-grid {\n  display: grid;\n  grid-template-columns: repeat(3, minmax(0, 1fr));\n  min-width: 0;\n  gap: 10px;\n}\n\n.tidal-scope .hover-card-demo-person {\n  display: grid;\n  grid-template-columns: 44px minmax(0, 1fr) 28px;\n  justify-content: stretch;\n  width: 100%;\n  min-width: 0;\n  min-height: 76px;\n  gap: 11px;\n  padding: 10px 12px;\n  text-align: start;\n}\n\n.tidal-scope .hover-card-demo-person > img,\n.tidal-scope .hover-card-demo-profile header > img {\n  width: 44px;\n  height: 44px;\n  border: 1px solid var(--t-border);\n  border-radius: 50%;\n  object-fit: cover;\n  filter: grayscale(1);\n}\n\n.tidal-scope .hover-card-demo-person > span:not(.hover-card-demo-person-mark) {\n  display: grid;\n  min-width: 0;\n  gap: 3px;\n}\n\n.tidal-scope .hover-card-demo-person :is(strong, small) {\n  min-width: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .hover-card-demo-person strong {\n  font-size: 12px;\n  font-weight: 650;\n}\n\n.tidal-scope .hover-card-demo-person small {\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.4;\n}\n\n.tidal-scope .hover-card-demo-person-mark {\n  display: grid;\n  width: 28px;\n  height: 28px;\n  place-items: center;\n  border: 1px solid var(--t-border);\n  border-radius: 50%;\n  font-size: 15px;\n  transition:\n    background 180ms,\n    color 180ms,\n    transform 220ms var(--t-ease-out);\n}\n\n.tidal-scope\n  .hover-card-demo-person[data-state=\"open\"]\n  .hover-card-demo-person-mark {\n  background: var(--t-ink);\n  color: var(--t-surface);\n  transform: rotate(45deg);\n}\n\n.tidal-scope .hover-card-demo-profile {\n  display: grid;\n  min-width: 0;\n  gap: 16px;\n}\n\n.tidal-scope .hover-card-demo-profile header {\n  display: grid;\n  grid-template-columns: 48px minmax(0, 1fr);\n  align-items: center;\n  min-width: 0;\n  gap: 12px;\n}\n\n.tidal-scope .hover-card-demo-profile header > img {\n  width: 48px;\n  height: 48px;\n}\n\n.tidal-scope .hover-card-demo-profile header > div {\n  display: grid;\n  min-width: 0;\n  gap: 3px;\n}\n\n.tidal-scope .hover-card-demo-profile :is(strong, span, p, dl, dt, dd) {\n  margin: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .hover-card-demo-profile strong {\n  font-size: 16px;\n  font-weight: 650;\n}\n\n.tidal-scope .hover-card-demo-profile header span,\n.tidal-scope .hover-card-demo-profile p,\n.tidal-scope .hover-card-demo-profile dd {\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.5;\n}\n\n.tidal-scope .hover-card-demo-profile dl {\n  display: grid;\n  gap: 8px;\n}\n\n.tidal-scope .hover-card-demo-profile dl > div {\n  display: grid;\n  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);\n  min-width: 0;\n  gap: 10px;\n  padding-top: 9px;\n  border-top: 1px solid var(--t-border);\n}\n\n.tidal-scope .hover-card-demo-profile dt {\n  display: inline-flex;\n  align-items: center;\n  gap: 5px;\n  font-size: 11px;\n  font-weight: 650;\n}\n\n.tidal-scope .hover-card-demo-profile footer {\n  padding: 9px 10px;\n  border-radius: 9px;\n  background: var(--t-wash);\n  font-size: 11px;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .hover-card-demo-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  min-width: 0;\n  gap: 14px;\n}\n\n.tidal-scope .hover-card-demo-footer span {\n  color: var(--t-muted);\n  font-size: 11px;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .hover-card-demo-footer button {\n  flex: 0 0 auto;\n  min-width: 44px;\n  min-height: 44px;\n  padding: 0 14px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  background: var(--t-surface);\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 11px;\n  font-weight: 620;\n}\n\n.tidal-scope .hover-card-demo-footer button:focus-visible {\n  outline: 2px solid var(--t-ink);\n  outline-offset: 3px;\n}\n\n@container tidal-hover-demo (max-width: 700px) {\n  .tidal-scope .hover-card-demo-grid {\n    grid-template-columns: minmax(0, 1fr);\n  }\n}\n\n@container tidal-hover-demo (max-width: 390px) {\n  .tidal-scope .hover-card-demo-footer {\n    align-items: stretch;\n    flex-direction: column;\n  }\n\n  .tidal-scope .hover-card-demo-footer button {\n    width: 100%;\n  }\n}\n\n@media (pointer: coarse) {\n  .tidal-scope .hover-card-demo-person,\n  .tidal-scope .hover-card-demo-footer button {\n    font-size: 16px;\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .hover-card-demo-person-mark {\n    transition: none;\n  }\n}";

type Profile = {
  id: string;
  name: string;
  role: string;
  location: string;
  detail: string;
  focus: string;
  avatar: string;
};

const PROFILES: Profile[] = [
  {
    id: "avery",
    name: "Avery Morgan",
    role: "Product designer",
    location: "Chicago",
    detail: "Shapes the workspace navigation and review flow.",
    focus: "Current focus · Project handoff",
    avatar: tidalExampleAvatarDataUri("04"),
  },
  {
    id: "noah",
    name: "Noah Bennett",
    role: "Frontend engineer",
    location: "Austin",
    detail: "Builds interface systems for the project workspace.",
    focus: "Current focus · File browser",
    avatar: tidalExampleAvatarDataUri("06"),
  },
  {
    id: "mila",
    name: "Mila Chen",
    role: "Research lead",
    location: "Toronto",
    detail: "Organizes customer notes and weekly product findings.",
    focus: "Current focus · Research summary",
    avatar: tidalExampleAvatarDataUri("08"),
  },
];

export function HoverCardDemo({
  theme = "light",
}: {
  theme?: "light" | "dark";
}) {
  const headingId = `${useId().replace(/:/g, "")}-team-directory`;
  const [openProfileId, setOpenProfileId] = useState<string | null>(null);
  const [status, setStatus] = useState("Choose a teammate to preview details.");

  return (
    <section className="hover-card-demo" aria-labelledby={headingId}>
      <header className="hover-card-demo-heading">
        <h2 id={headingId}>Team directory</h2>
        <p>Hover, focus, or tap a teammate to preview their details.</p>
      </header>

      <div className="hover-card-demo-grid" aria-label="Fictional teammates">
        {PROFILES.map((profile) => (
          <TidalHoverCard
            theme={theme}
            key={profile.id}
            open={openProfileId === profile.id}
            onOpenChange={(open) => {
              setOpenProfileId(open ? profile.id : null);
              if (open) setStatus(`${profile.name} preview opened.`);
            }}
            accessibleDescription={`${profile.name}, ${profile.role} in ${profile.location}. ${profile.detail} ${profile.focus}.`}
          >
            <TidalHoverCardTrigger className="hover-card-demo-person">
              <img src={profile.avatar} alt="" />
              <span>
                <strong>{profile.name}</strong>
                <small>{profile.role}</small>
              </span>
              <span className="hover-card-demo-person-mark" aria-hidden="true">
                +
              </span>
            </TidalHoverCardTrigger>

            <TidalHoverCardContent
              role="region"
              aria-label={`${profile.name} profile preview`}
            >
              <article className="hover-card-demo-profile">
                <header>
                  <img src={profile.avatar} alt="" />
                  <div>
                    <strong>{profile.name}</strong>
                    <span>{profile.role}</span>
                  </div>
                </header>
                <p>{profile.detail}</p>
                <dl>
                  <div>
                    <dt>
                      <MapPin size={14} aria-hidden="true" /> Location
                    </dt>
                    <dd>{profile.location}</dd>
                  </div>
                  <div>
                    <dt>Work</dt>
                    <dd>{profile.focus.replace("Current focus · ", "")}</dd>
                  </div>
                </dl>
                <footer>{profile.focus}</footer>
              </article>
            </TidalHoverCardContent>
          </TidalHoverCard>
        ))}
      </div>

      <footer className="hover-card-demo-footer">
        <span role="status" aria-live="polite">
          {status} Sample profiles stay on this page.
        </span>
        <button
          type="button"
          onClick={() => {
            setOpenProfileId(null);
            setStatus("Profile preview closed.");
          }}
        >
          Close preview
        </button>
      </footer>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <HoverCardDemo />
    </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":["Tab and Shift+Tab follow the component's native focus order.","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."}

accessibleDescription and children are required. TidalHoverCard forwards controlled or uncontrolled Radix open state, delays and onOpenChange while adding portal theme and direction. The always-mounted accessibleDescription is combined with any native trigger aria-describedby value so the informational preview has a keyboard and screen-reader equivalent even while visually closed. TidalHoverCardTrigger renders a 44px native type=button with native attributes/ref, generated aria-controls and controlled aria-expanded; disabled or aria-disabled true resolve native disabled behavior and explicit false is preserved. Radix supplies hover/focus opening, pointer grace, Escape/outside dismissal and positioning. Caller-first unprevented button activation opens immediately. A stationary touch toggles only on touch end; movement over 10px or cancellation clears the intent, and the matching synthetic click is suppressed. TidalHoverCardContent forwards content attributes/ref, collision/side/alignment and caller-preventable dismissal events, accepts an optional portalContainer and arrow, and is viewport bounded with internal scrolling. Content is informational because Radix removes descendants from the tab order; use another overlay for interactive controls. Consumers own all content and state. The component performs no navigation, profile, account, network, storage or backend action.
