Overlays Core Stable

HoverCard

An anchored panel that opens on hover or focus with a short delay, for richer previews than a tooltip — a profile card, a link preview

Preview

Installation

pnpm add fancy-ui-svelte
import { HoverCard } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { HoverCard } from 'fancy-ui-svelte';
</script>

<HoverCard />

Examples

Basic Usage

A profile preview that opens on hover or focus.

With Stats

A richer card with a stats row, anchored above the trigger.

Props

PropTypeDefaultDescription
open booleanfalseWhether the card is open. Bindable
onOpenChange (open: boolean) => void-Fires whenever the open state changes, from any trigger
side "top" | "bottom" | "left" | "right""bottom"Side of the trigger the card opens on. Flips when it would overflow
align "start" | "center" | "end""center"Alignment along the trigger's cross axis
offset number8Gap in pixels between the trigger and the card
openDelay number300Ms before the card opens after the pointer enters the trigger. Ignored for focus, which opens immediately
closeDelay number150Ms before the card closes after the pointer leaves. Lets it travel from the trigger to the card without the card vanishing mid-trip
class string-Additional classes for the card panel
ref HTMLDivElement | nullnullBindable reference to the trigger wrapper

Slots

SlotDescription
triggerThe element that opens the card on hover or focus. Receives the card's id (or undefined while closed) — put it on your own trigger element's aria-describedby
childrenThe card's content. Supplementary only — see the README before adding links or buttons