Skip to content

HoverCard

A preview of what a link points to, shown while the pointer rests on it or the keyboard focuses it: a person, a table, a commit. It only previews; the link still goes there.

import { HoverCard } from '@sypnia/ui/react'

On this page
  1. A person and a table
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

A person and a table

Rest the pointer on a name, or reach it with Tab.

Last change by Ana Ruiz on the table orders.

Code
import { HoverCard, Identity, KeyValue, Link } from '@sypnia/ui/react';

// Rest the pointer on a name, or reach it with Tab: a preview of who it is. The link still goes to the profile.
export default function People() {
  return (
    <p>
      Last change by{' '}
      <HoverCard label="Ana Ruiz" trigger={<Link href="#ana">Ana Ruiz</Link>}>
        <Identity name="Ana Ruiz" meta="ana@northwind.io" />
        <KeyValue items={[['Role', 'Owner'], ['Joined', 'March 2026']]} />
      </HoverCard>
      {' '}on the table <HoverCard label="orders" trigger={<Link href="#orders">orders</Link>}>
        <KeyValue items={[['Rows', '18,240'], ['Size', '9 MB'], ['Access', '3 policies']]} />
      </HoverCard>.
    </p>
  );
}

Skeleton

The real piece and its skeleton: the same box, so nothing moves when the data arrives.

ARAna Ruizana@northwind.io

Owner of the project since March.

Code
import { HoverCardSkeleton, Identity } from '@sypnia/ui/react';

// The body of a card while its details load, beside the real one.
export default function Skeleton() {
  return (
    <div className="sy-grid">
      <div className="sy-popover sy-hovercard"><div className="sy-hovercard__body"><Identity name="Ana Ruiz" meta="ana@northwind.io" /><p>Owner of the project since March.</p></div></div>
      <div className="sy-popover sy-hovercard"><HoverCardSkeleton /></div>
    </div>
  );
}

When to use it

Use it when

  • Names of people, tables and other things that are mentioned often.
  • Two or three facts that help decide whether to follow the link.

Do not use it when

  • Content that someone must read or act on: put it on the page.
  • Buttons or forms inside it: they are hard to reach before it closes.
  • Touch screens as the only way to see it: it opens on hover and focus.

For everyone

  • It opens on keyboard focus too, and Escape closes it.
  • Its content describes the link (aria-describedby) while it is open.
  • Everything in it is also on the page the link leads to.

Props

HoverCardTypeDefault
labelrequired

What is previewed, for screen readers: «Ana Ruiz».

string
triggerrequired

A link or a button; the card opens beside it.

ReactElement<any, string | JSXElementConstructor<any>>
delay

Milliseconds the pointer rests before it opens.

number 450
  1. A person and a table
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms