Skip to content

HoverCard

import { HoverCard } from '@yarcl/react';
Written by @ada
<HoverCard content={<UserPreview id="ada" />}>
<Link href="/users/ada">@ada</Link>
</HoverCard>

The pointer can move from the trigger into the card without closing it, so the card can contain links. Hover cards are supplementary: don’t put anything in them that isn’t reachable elsewhere.

Spacing props accept typed breakpoint maps. See responsive props for supported props, defaults and examples.

PropTypeDefaultDescription
children requiredReactElementA single focusable element, usually a Link.
content requiredReactNodeRich preview content. Can contain links; the pointer can move into the card without closing it.
closeDelaynumberconfig.timing.hoverCloseDelayDelay before closing after the pointer leaves, in ms.
openDelaynumberconfig.timing.hoverOpenDelayDelay before opening, in ms.
paddingResponsive<Spacing>configconfig.defaults.paddingInner padding, from the spacing config. Accepts a scalar or breakpoint map.
placementPlacement'bottom'Preferred side. Flips when there isn't room.
radiusRadiusconfigconfig.defaults.radiusCorner radius, from the radii config.
refRef<Element>