Knit UI
GitHub

Playground

Loading playground…

true
false
false
false
false
false
Playground
<HoverCard
  position="bottom"
  openDelay={0}
  closeDelay={150}
  offset={8}
  width="max-content"
  withinPortal
  keepMounted={false}
  shadow="md"
  disabled={false}
  withArrow={false}
  withOverlay={false}
/>

Examples

Transitions

Configurable enter/exit animation via transitionProps (forwarded to the underlying Popover). Pick a preset, then hover the target to watch it animate in and out.

Loading example…

TransitionsSourceStorybook

Compound API

Demonstrates the compound API: Target wraps the trigger, Dropdown holds the content.

Loading example…

Compound APISourceStorybook

Initially Opened

Opens immediately on hover; start open via initiallyOpened for visual snapshot.

Loading example…

Initially OpenedSourceStorybook

Disabled

Disabled — the dropdown never opens regardless of hover.

Loading example…

DisabledSourceStorybook

With Arrow

Arrow points from the dropdown back toward the target.

Loading example…

With ArrowSourceStorybook

With Delays

Open and close delays make the interaction feel less jittery.

Loading example…

With DelaysSourceStorybook

Keep Mounted

keepMounted keeps the dropdown in the DOM (hidden) while closed.

Loading example…

Keep MountedSourceStorybook

Positions

All supported placements shown together to compare positioning.

Loading example…

PositionsSourceStorybook

Shadows

All five shadow levels side by side to compare dropdown elevation. Each card is always open (initiallyOpened) and rendered in its own contained relative wrapper (withinPortal={false}) so the dropdowns sit inline and don't overlap.

Loading example…

ShadowsSourceStorybook

Styles

Per-slot styles targets individual parts — here the dropdown and arrow.

Loading example…

StylesSourceStorybook

Callbacks

Open/close callbacks let consumers react to hover-driven visibility changes.

Loading example…

CallbacksSourceStorybook

Props

PropTypeDefaultDescription
animationMotionPresetName | undefinedMotion preset for the dropdown — the unified `animation` vocabulary shared with Modal/Dialog/Drawer. Forwarded to the underlying `Popover`; sugar over `transitionProps.transition`, which wins if both are set.
arrowOffsetnumber | undefined5Arrow distance from the start/end edge when `arrowPosition="side"`.
arrowPositionArrowPosition | undefined'side'Arrow alignment: centered, or pinned toward an aligned placement.
arrowRadiusnumber | undefined0Corner radius of the arrow's outward corner in px.
arrowSizenumber | undefined7Arrow square edge length in px.
childrenReactNodeTarget + dropdown.
closeDelaynumber | undefined150Delay in ms before the dropdown closes on leave.
disabled systemboolean | undefinedfalseDisable the hover card (never opens).
initiallyOpenedboolean | undefinedfalseInitial opened state (HoverCard is hover-driven, not value-controlled).
keepMountedboolean | undefinedfalseKeep the dropdown mounted while closed (adds `display: none`).
offsetFloatingOffset | undefined8Main-axis gap in px between the target and the dropdown.
onClose(() => void) | undefinedCalled when the dropdown closes.
onOpen(() => void) | undefinedCalled when the dropdown opens.
onPositionChange((position: HoverCardPosition) => void) | undefinedCalled with the RESOLVED placement whenever it changes (e.g. on flip/shift).
openDelaynumber | undefined0Delay in ms before the dropdown opens on hover.
overlayPropsPartial<OverlayProps> | undefined
positionPlacement | undefined
top · top-start · top-end · bottom · bottom-start · bottom-end · left · left-start · left-end · right · right-start · right-end
'bottom'Dropdown placement relative to the target.
radius systemRadiusTokens | undefinedDropdown border radius token.
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
xs · sm · md · lg · xl
'md'Dropdown shadow scale.
styles systemSlotStyles<HoverCardStyles> | undefinedPer-slot style sugar — props spread onto the matching styled part.
transitionPropsOverlayTransitionConfig | undefined{ transition: 'fade', duration: 150, timingFunction: 'ease-in-out' }Enter/exit animation: { transition, duration, exitDuration, timingFunction }. Defaults to a 150ms fade.
widthHoverCardWidth | undefined'max-content'Dropdown width; 'target' matches the trigger width.
withArrowboolean | undefinedfalseRender an arrow pointing at the target.
withinPortalboolean | undefinedtrueRender the dropdown in a portal.
withOverlayboolean | undefinedfalseRender a full-cover `Overlay` scrim behind the open dropdown.
zIndexnumber | undefined300Dropdown `z-index`.

Style slots

Every part of HoverCard can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotUsage
arrowstyles={{ arrow: { … } }}
dropdownstyles={{ dropdown: { … } }}
overlaystyles={{ overlay: { … } }}
targetstyles={{ target: { … } }}