Components/Surfaces/Hover Card
COMPONENT24.24

Hover Card

Rich preview surfacing on hover or focus of a trigger, with open intent delay and flip-on-overflow placement.


INSTALL

1pnpm dlx @sayagodev/mo add hover-card

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/hover-card.css";2import "@sayagodev/mo/js/hover-card.js";

EXAMPLES

Demo
@nextjs

The React Framework – created and maintained by @vercel.

Joined December 2021

Sides
Hover Card

This hover card appears below the trigger — the default side.

Hover Card

This hover card appears above the trigger.

Hover Card

This appears to the left of the trigger.

Hover Card

This appears to the right of the trigger.

USAGE

1<mo-hovercard>2  <button type="button" class="link">@nextjs</button>3  <div popover id="hc1">4    <strong>@nextjs</strong>5    <p>The React Framework.</p>6  </div>7</mo-hovercard>

API

NAMEKINDDESCRIPTION
<mo-hovercard>elementHover lifecycle, placement, aria-expanded sync
> :not([popover])elementTrigger; the card opens on hover + focus
> [popover]elementCard surface, w-80; data-side="top" prefers above (sides flip on overflow)
--mo-hover-card-*tokenWidth and radius hooks

FILES

src/css/hover-card.csssrc/js/hover-card.js
Install:mo add hover-card

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--foreground--popover--popover-foreground--radius
Component hooks
--mo-hover-card-radius--mo-hover-card-width

Preview

@operator

Keeps the Nuo workbench running from Monterrey.

Joined December 2021

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.