Xzero UI
Pro library

Card to articlePro

Story cards that open into full articles with one seamless morph and shrink back into their exact slot when dragged down.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/card-to-article
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/card-to-article

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { CardToArticle } from "@/components/xzero/card-to-article/card-to-article";

const posts = [
  {
    id: "glass-house",
    tag: "Case study",
    title: "A glass house that stays cool in August",
    meta: "5 min read",
    image: "/media/photos/pool-house.jpg",
    imageAlt: "A modern glass house beside a long pool",
    body: <p>The brief was simple and a little unreasonable...</p>,
  },
];

export function Journal() {
  return <CardToArticle items={posts} />;
}

API reference

CardToArticle

A grid of story cards; a card opens into a full scrolling article with a shared element morph and closes back into its slot.

PropTypeDefaultDescription
items (required)ArticleItem[]–Each item has id, title, image, imageAlt, body, and optional tag and meta.
valuestring | null–Id of the open article. Leave it out for uncontrolled use.
defaultValuestring | nullnullInitially open article when uncontrolled.
onValueChange(id: string | null) => void–Called when an article opens or closes.
aspectRationumber4 / 3Ratio of the card and the article hero. They match, so the morph is a pure scale with no distortion.
closeLabelstring"Close article"Accessible name of the close button.
classNamestring–Extra class on the root.

Keyboard interactions

KeysAction
Enter / SpaceOpens the focused card.
EscapeCloses the article and returns focus to its card.
TabStays inside the open article.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in surfaces

Guidance for AI tools

Card to article: Story cards that open into full articles with one seamless morph and shrink back into their exact slot when dragged down. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components