Preview Card

A rich preview component for displaying linked content.

Installation

Install the component package, shared coss-svelte theme, and Bits UI peer.

npm install coss-svelte @coss-svelte/theme bits-ui

Usage

Import the Svelte component exports directly from the package.

import { PreviewCard, PreviewCardPopup, PreviewCardTrigger } from "coss-svelte";

Anatomy

  • PreviewCard
  • PreviewCardPopup
  • PreviewCardTrigger

API Reference

PreviewCard

A rich preview component for displaying linked content.

PropTypeDefaultDescription
hrefstring"#"Renders the component as a link target when provided.
labelstring"Preview"Accessible label or fallback visible label for the control.
titlestring"Preview"Title text rendered by the component's built-in fallback layout.
descriptionstring""Supporting text rendered by the component's built-in fallback layout.
children : Snippet<[]>

Inherits from Bits UI LinkPreview.Root.

PreviewCardPopup

Renders the floating or modal surface for the parent component.

PropTypeDefaultDescription
portalProps{ disabled?: boolean; to?: PortalTarget }{}Configures the exact Bits Portal target (`to`) or renders inline when `disabled`.
children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI LinkPreview.Content.

PreviewCardTrigger

Renders the control that opens, closes, or selects related content.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI LinkPreview.Trigger.

Implementation Details

Status
Stable
Foundation
bits
Category
Overlays & Popups
Particles
1