Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Overlays & Actions

Hover Card

Rich preview on hover or focus — delays, asChild trigger, side/align positioning, shadcn-aligned examples. Reveal the right amount of context without losing the user's place in the interface. Keep the trigger, content and dismissal behavior working as one interaction. Import it from @/components/kamod-ui/hover-card.

Source · Design reference · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Import HoverCard, HoverCardTrigger and HoverCardContent from @/components/kamod-ui/hover-card.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Usage

Wrap a trigger and content. Use openDelay and closeDelay on HoverCard to avoid accidental opens. Use HoverCardTrigger asChild to use a Button or link. Position content with side and align on HoverCardContent.

Import SetupTypeScript
import { HoverCard } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Component Examples & Variants

Explore Hover Card in Different Contexts, from the starting pattern to the compositions below. Begin with Demo, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Demo

Offer Supplementary Context without Requiring It. Use a link-style trigger with a structured hover-card body to reveal supplementary context about a person or resource. The compact preview adds detail near the reference without turning the page into a permanently expanded profile.

Keep essential information available elsewhere for touch and keyboard users, and choose Popover when the panel must contain a deliberate interactive workflow.

src/components/HoverCardExample.tsx14 lines
import { Button, HoverCard, HoverCardContent, HoverCardTrigger } from "@kamod-ch/ui";

export const Example = () => (
  <HoverCard openDelay={10} closeDelay={100}>
    <HoverCardTrigger asChild>
      <Button variant="link">Hover Here</Button>
    </HoverCardTrigger>
    <HoverCardContent class="flex w-64 flex-col gap-0.5">
      <div class="font-semibold">@nextjs</div>
      <div>The React Framework – created and maintained by @vercel.</div>
      <div class="text-muted-foreground mt-1 text-xs">Joined December 2021</div>
    </HoverCardContent>
  </HoverCard>
);

Usage

Keep the Trigger Understandable without the Preview. Start with HoverCardTrigger and HoverCardContent to understand their relationship before adding a custom trigger style. The content should remain supplemental, with the page's main meaning available even when the card is closed.

Do not put the only explanation of an unfamiliar action inside a hover-only surface, and verify how the surrounding page behaves without pointer hover.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Trigger Delays

Balance Responsiveness with Accidental Activation. Set openDelay and closeDelay on HoverCard to tune how quickly the preview appears and disappears. A short delay can reduce accidental openings while leaving enough time to move toward the displayed content.

Tune delays with realistic pointer movement and content length, and keep the preview supplementary rather than extending it into a hidden task interface.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Positioning

Keep the Preview Visually Attached to Its Trigger. Set side and align on HoverCardContent to place the preview relative to its trigger. Choose a position that leaves room for the content and does not obscure the information that prompted the hover.

Test triggers near viewport edges and inside scrolling regions, and avoid large offsets that make it unclear which link produced the card.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Sides

Compare Placement Using Realistic Content. Compare top, right, bottom and left placement using the same hover-card content. The side choice affects where the supplemental panel fits, while its label, purpose and underlying reference remain unchanged.

Inspect each edge of the viewport and choose a consistent default; placement should support reading rather than alternate arbitrarily between nearby triggers.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Hover Card using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Props, slots and variants for this component.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
@kamod-ch/ui/hover-card12.4 KB min · 3.5 KB gzipSignals: direct@preact/signals

HoverCard

HoverCardProps

HoverCard documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildHoverCardProps

Configure children for HoverCard. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
closeDelay
numberHoverCardProps

Delay before closing (ms). Radix default 300.

Default
300
defaultOpen
booleanHoverCardProps

Configure defaultOpen for HoverCard. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
openDelay
numberHoverCardProps

Delay before opening (ms). Radix default 700.

Default
700

HoverCardContent

HoverCardContentProps

HoverCardContent documented props
Prop / typeDescription
align
"start" | "center" | "end"HoverCardContentProps

Configure align for HoverCardContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"center"
children
ComponentChild[] | ComponentChildHoverCardContentProps

Configure children for HoverCardContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>HoverCardContentProps

Configure class for HoverCardContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onKeyDown
KeyboardEventHandler<HTMLDivElement>HoverCardContentProps

Configure onKeyDown for HoverCardContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onMouseEnter
MouseEventHandler<HTMLDivElement>HoverCardContentProps

Configure onMouseEnter for HoverCardContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onMouseLeave
MouseEventHandler<HTMLDivElement>HoverCardContentProps

Configure onMouseLeave for HoverCardContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
side
"bottom" | "top" | "right" | "left"HoverCardContentProps

Configure side for HoverCardContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"bottom"
sideOffset
numberHoverCardContentProps

Configure sideOffset for HoverCardContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
8
style
string | CSSProperties | SignalLike<string | CSSProperties | undefined>HoverCardContentProps

Configure style for HoverCardContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

HoverCardTrigger

HoverCardTriggerProps

HoverCardTrigger documented props
Prop / typeDescription
asChild
booleanHoverCardTriggerProps

Configure asChild for HoverCardTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
children
ComponentChild[] | ComponentChildHoverCardTriggerProps

Configure children for HoverCardTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>HoverCardTriggerProps

Configure class for HoverCardTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onBlur
FocusEventHandler<HTMLButtonElement>HoverCardTriggerProps

Configure onBlur for HoverCardTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onFocus
FocusEventHandler<HTMLButtonElement>HoverCardTriggerProps

Configure onFocus for HoverCardTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onMouseEnter
MouseEventHandler<HTMLButtonElement>HoverCardTriggerProps

Configure onMouseEnter for HoverCardTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onMouseLeave
MouseEventHandler<HTMLButtonElement>HoverCardTriggerProps

Configure onMouseLeave for HoverCardTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
ref
Ref<HTMLButtonElement>HoverCardTriggerProps

Configure ref for HoverCardTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

HoverCardContextValue

7 declared fields
HoverCardContextValue
Exported Source Declaration from HoverCard.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of HoverCardContextValue before adapting it.
Required fields
open, openDelay, closeDelay, scheduleOpen, scheduleClose, pinOpen, setOpenImmediate

HoverCard Props

4 declared fields
HoverCardProps
Exported Source Declaration from HoverCard.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of HoverCardProps before adapting it.

HoverCardContent Props

4 declared fields
HoverCardContentProps
Exported Source Declaration from HoverCardContent.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of HoverCardContentProps before adapting it.

HoverCardTrigger Props

2 declared fields
HoverCardTriggerProps
Exported Source Declaration from HoverCardTrigger.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of HoverCardTriggerProps before adapting it.

Accessibility

Build the Complete Interaction, Including the Parts Outside Hover Card. The notes below distinguish the current implementation from the labels, content and behavior your application supplies. Start with the Live Preview, check the Props and Data Reference, and test the finished composition with real content rather than assuming that an unchanged visual example covers every use case.

Built-in Behavior and Defaults

HoverCard opens on pointer hover and trigger focus, and its content uses a non-modal dialog role. Escape dismisses the content. Opening on focus makes it more discoverable than pointer-only content, but it is still supplemental information.

Labels and Relationships

Keep the trigger a meaningful destination or subject, such as a person's name. Give the panel an understandable name when its contents form a distinct dialog-like region, and avoid repeating a long profile as the trigger's accessible name.

Keyboard and Focus

Test focus moving from the trigger toward any interactive content and then away. Delayed opening and closing must not prevent users from reaching a link. Keep the underlying profile or detail page available through a normal navigation path.

States and Integration Details

Do not require hover-card access to complete an essential action. Small pointer gaps, touch input and screen-reader navigation can change how the surface is encountered. Use a deliberate popover or dialog for a task that must remain open.

Verify the Complete Interaction

Check Behavior as Well as Markup. Work through these scenarios in the application where the component will be used. Automated checks can help find structural problems; also review the reading experience with a screen reader, keyboard focus and the actual feedback from your application.

  1. Open through focus as well as hover and dismiss using Escape.
  2. Reach any panel links without the card closing prematurely or trapping focus.
  3. Verify the same important information is available through a persistent page or control.

Recheck the result after changing Theme Tokens, translations or class overrides. Include text enlargement, narrow layouts and reduced-motion settings where animation is present. Inspect the Component Source when a behavior differs from your expectation; a role or state attribute does not implement keyboard interaction by itself.

For background, read the WAI-ARIA Authoring Guidance and Keyboard Interface Guidance. These explain the patterns; verify browser and assistive-technology behavior for the implementation and audience you actually support.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.