XiodUI
HomeDocs
OverviewComponentsStyling & CustomizationChangelog

Components

  • Accordion
  • Agent Steps
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Autocomplete
  • Avatar
  • Badge
  • Breadcrumb
  • Button
  • Button Group
  • Button Split
  • Calendar
  • Card
  • Carousel
  • Checkbox
  • Circular Progress
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy To Clipboard
  • Corner Badge
  • Dashboard Grid
  • Date Picker
  • Dialog
  • Dot Matrix
  • Draggable
    Updated
  • Drawer
  • Empty
  • Field
  • Fieldset
  • File Upload
    Updated
  • Form
  • Frame
  • Gauge
  • Grid
  • Group
  • Input
  • Input Group
  • Input OTP
  • Input Payment
  • Input Phone
    Updated
  • Input Sensitive
  • Kbd
  • Kinetic Click
  • Label
  • List Box
    Updated
  • Loader
  • Marker
  • Menu
  • Menubar
  • Message
  • Meter
  • Morphic Toast
  • Navigation Menu
  • Number Field
  • Option Picker
  • Orb
  • Pagination
  • Popover
  • Preview Card
    Updated
  • Progress
  • Radio
  • Resizable
  • Ruler Picker
  • Scroll Area
  • Scroll Bar
  • Select
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Sortable
  • Switch
  • Table
  • Tabs
  • Text
  • Textarea
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Toolbar
  • Tooltip
  • Waveform
  • Wheel Picker

Loading...

Preview Skeleton

Installation Skeleton

Usage Skeleton

API Reference Skeleton

Sponsors

Support the development of XiodUI and help us build the best component library on Earth.

+++
Sponsor on GitHub

Preview Card

Previous: PopoverNext: Progress

A card that previews a link's content when the link is hovered or focused.

Preview

Loading Preview...

Installation

bun add xiod-ui

Usage

Imports

1import {2  PreviewCard,3  PreviewCardArrow,4  PreviewCardPopup,5  PreviewCardTrigger,6  PreviewCardCreateHandle7} from "xiod-ui/preview-card";

Anatomy

1<PreviewCard>2  <PreviewCardTrigger />3  <PreviewCardPopup />4</PreviewCard>5<PreviewCardTrigger />

API Reference

Detailed documentation of properties and options.

PreviewCard

PropTypeDefaultDescription
actionsRef
RefObject<PreviewCardRootActions | null>
–

A ref to imperative actions.

  • unmount: Ends the closing phase of the preview card after an externally controlled closing animation finishes.

Call preventUnmountOnClose() in onOpenChange first, otherwise the preview card completes closing on its own. Whether it leaves the DOM is decided by keepMounted on the portal.

PopoverProgress
  • close: Closes the preview card imperatively when called.
  • children
    ReactNode | PayloadChildRenderFunction<Payload>
    –

    The content of the preview card. This can be a regular React node or a render function that receives the payload of the active trigger.

    defaultOpen
    boolean
    false

    Whether the preview card is initially open.

    To render a controlled preview card, use the open prop instead.

    defaultTriggerId
    string|null
    –

    ID of the trigger that the preview card is associated with. This is useful in conjunction with the defaultOpen prop to create an initially open preview card.

    handle
    PreviewCardHandle<Payload>
    –

    A handle to associate the preview card with a trigger. If specified, allows external triggers to control the card's open state. Can be created with the PreviewCard.createHandle() method.

    onOpenChange
    ((open: boolean, eventDetails: PreviewCardRootChangeEventDetails) => void)
    –

    Event handler called when the preview card is opened or closed.

    onOpenChangeComplete
    ((open: boolean) => void)
    –

    Event handler called after any animations complete when the preview card is opened or closed.

    open
    boolean
    –

    Whether the preview card is currently open.

    triggerId
    string|null
    –

    ID of the trigger that the preview card is associated with. This is useful in conjunction with the open prop to create a controlled preview card. There's no need to specify this prop when the preview card is uncontrolled (that is, when the open prop is not set).

    PreviewCardArrow

    Accepts className, style and render, plus every native attribute of the element it renders.

    PreviewCardPopup

    Accepts className, style and render, plus every native attribute of the element it renders.

    PropTypeDefaultDescription
    align
    "center"|"start"|"end"
    center

    How the calendar lines up with the trigger along that side.

    alignOffset
    number|OffsetFunction
    0

    Additional offset along the alignment axis, in pixels.

    anchor
    PreviewCard$1.Positioner.Props["anchor"]
    –

    An element to position the popup against. Defaults to the trigger.

    hideArrow
    boolean
    false

    Whether to hide the arrow that points at the trigger.

    side
    "top"|"bottom"|"left"|"right"|"inline-end"|"inline-start"
    bottom

    Which side of the copy button the tooltip and toast open on.

    sideOffset
    number|OffsetFunction
    8

    The gap between the trigger and the calendar, in pixels.

    PreviewCardTrigger

    Accepts className, style and render, plus every native attribute of the element it renders.

    PropTypeDefaultDescription
    closeDelay
    number
    300

    How long to wait before closing the preview card. Specified in milliseconds.

    delay
    number
    600

    How long to wait before the preview card opens. Specified in milliseconds.

    handle
    PreviewCardHandle<unknown>
    –

    A handle to associate the trigger with a preview card.

    payload
    unknown
    –

    A payload to pass to the preview card when it is opened.

    Helpers

    PreviewCardCreateHandle is called, not rendered. It creates a handle: pass it as handle to a trigger and to the root, and the trigger can sit anywhere in the tree, outside the root.