Skip to content

PreviewCard ​

A card that opens on hover over its trigger, usually a link, drawn like a popover, to preview the link's target.

tsx
import { PreviewCard } from '@adecore/ui';
tsx
import { PreviewCard } from '@adecore/ui';

export default function PreviewCardDemo() {
    return (
        <p className="max-w-md text-sm text-text-muted">
            The fix landed in{' '}
            <PreviewCard.Root>
                <PreviewCard.Trigger href="https://github.com/basmilius/adecore" className="font-medium text-accent underline">
                    #128
                </PreviewCard.Trigger>
                <PreviewCard.Popup className="w-72 p-3">
                    <p className="text-sm font-medium text-text">Keep a nested dialog above its parent</p>
                    <p className="mt-1 text-xs text-text-muted">Merged two days ago, 3 files changed.</p>
                </PreviewCard.Popup>
            </PreviewCard.Root>{' '}
            after a week of review.
        </p>
    );
}

Parts ​

PartWhat it is
PreviewCard.RootHolds the open state, and the delays before it opens and closes.
PreviewCard.TriggerThe link the card belongs to. It renders an <a>.
PreviewCard.PopupPortal, positioner and card, with the variant and placement props of Popover.Popup.

The card opens only for the pointer, so keep anything a person needs on the page or behind the link.

PreviewCardPopupProps is an exported type.

Licenses and third-party notices are listed in each package.