Platform
VaultVault
  • Free15
  • Navigation19
  • Buttons9
  • Scroll55
  • Text27
  • Sliders & marquees19
  • Gallery & images67
  • Cursor24
  • Page transitions10
  • Loaders2
  • Backgrounds10
  • UI components33
ButtonsPart of ProButtons
IconsPart of ProIcons
  • Interface Essentials144
  • Social Icons69
  • Payment Badges41
SavedPart of ProSaved
Support
DocumentationDocumentation
MCP serverMCP server
SettingsSettings
VaultUI componentsExpanding Card Modal
Capsule Image HeroBrowse all 182Sticky Chapter Swap
  • Free15
  • Navigation19
  • Buttons9
  • Scroll55
  • Text27
  • Sliders & marquees19
  • Gallery & images67
  • Cursor24
  • Page transitions10
  • Loaders2
  • Backgrounds10
  • UI components33
  • Interface Essentials144
  • Social Icons69
  • Payment Badges41
Sign inSign in

Start free. The code for 15 components, no card needed.

Get 15 free

Expanding Card Modal

This one is locked. Become a member to open the code for it and the rest of the Vault.

See plansTry the 15 free ones

What you'll need.

Install

    Setup

    npm i gsap

    More like this

    • Card
    • Modal
    • Expand
    • Morph

    Features.

    • A card grows into a dialog: its image, title and short line morph straight into their places in the open dialog
    • The rest of the page, the backdrop and the dialog-only content cross-fade around the morph
    • Closing runs the same morph in reverse, back into the card, from the close icon, Escape or a backdrop click
    • Built on a native <dialog> with showModal(): top layer, focus trap, inert page and focus back to the card for free
    • The page doesn't scroll while a dialog is open; long dialogs scroll inside themselves
    • A soft overshoot on the morph, tuned by one option: data-au-duration
    • Cards lift 2px on hover
    • No library: native View Transitions and plain CSS. Browsers without View Transitions open and close the dialog instantly
    • Respects prefers-reduced-motion: no morph, no lift

    How to get it right.

    Mark the same parts on both sides

    A part morphs only when it has the same data-cdl-part in the card and in the dialog. Six roles are styled for it: face, media, tag, title, pieces and meta. Anything without a role simply fades in with the dialog.

    Adding extras

    It ships with an image, a title and one line. Add data-cdl-part="tag" (.cdl_tag) or data-cdl-part="meta" (.cdl_meta) to both sides and they morph too. Inside the dialog, .cdl_note, .cdl_list-wrap and a .cdl_foot of .cdl_btns are styled and fade in with it; .cdl_cta is a call to action on the card. In React, pass tag, meta, note, listTitle and items on each look; the buttons go in the JSX.

    Keep text parts short

    Text parts cross-fade between their two sizes rather than stretching, so a title that wraps differently in the card and the dialog still looks clean. Short titles and one-line meta read best.

    Pick a picture that crops well both ways

    The card image is wide and short, the dialog image taller. Both are object-fit: cover with the focus 12% from the top, so put the subject near the top of the picture.

    Stay near the default time

    0.4s feels like the card is lifting into place. Above 0.8s the overshoot starts to feel slow; below 0.25s the cross-fades get hard to follow.

    Variations.

    • Default — a 0.4s morph with a soft overshoot
    • Snappy — data-au-duration="0.25" for product grids where people open many in a row
    • Slow reveal — data-au-duration="0.8" for an editorial, one-at-a-time feel
    • Your colours — override --cdl-surface, --cdl-fg, --cdl-accent, --cdl-backdrop and --cdl-radius on .cdl_grid

    Where it fits.

    • Lookbooks and collections — a card per look, details in the dialog, the setup this demo shows
    • Team pages — a portrait card that opens into a bio
    • Pricing or plan cards — the card opens into the full feature list
    • Case study teasers — a summary card that opens into a short write-up

    Frequently asked.

    Browsers with same-document View Transitions (document.startViewTransition): current Chrome, Edge, Safari and Firefox. Others open and close the dialog instantly; nothing breaks.

    Yes. Anything inside the <dialog> without a data-cdl-part fades in with it. Focus stays trapped inside while it's open.

    The card and the dialog are the same object in the morph, so the card hides (is-open on the look) until the dialog closes back into it.

    Each [data-au-card-dialog] is its own instance, and only one morph runs at a time on a page. Keep dialog ids unique.

    The dialog face carries data-lenis-prevent, so Lenis leaves its scrolling alone. Stop Lenis yourself while a dialog is open if the page still moves behind it.

    Related components.

    Pro

    Image Slide Tabs

    Click

    Pro

    Glow Band Sheet Modal

    Click

    Pro

    Cursor Follow Tooltip

    Cursor