Skip to content
English
Card lock sheet comes with Pro. Its preview shows once you unlock it.

How it works

The component is the whole scene, so the card, the blur and the sheet share one timeline. Opening: the card tips its top edge toward you (rotateX −18° and 28px closer at 38% of 620ms) and lands flat while it shrinks to 64% toward the top; a veil with a 10px backdrop blur fades in over the screen content in 360ms; the sheet rises in 460ms after 60ms, and its title, details panel and lock row follow 40ms apart. Closing runs the other way, quicker: the sheet drops in 280ms, the card folds back with a small tip the other way and springs to full size. Locking frosts the card: a cool tint with fine rime and a backdrop desaturate fades in, a glint crosses once, and a Locked badge springs onto the middle. Copy writes the value without spaces to the clipboard and swaps its icon for a check for 1.6s.

Use it for

  • The card screen of a banking, wallet or expense app.
  • Revealing sensitive details on demand, with copy buttons for paying online.
  • Letting people freeze a card themselves when it goes missing.

Look elsewhere when

  • Card pickers or lists of several cards: show them as a list first.
  • Forms where people type card details: use input fields.
  • Anything that is not a card: the scene is built around one.

Usage

import { useState } from 'react'
import { CardLockSheet } from './CardLockSheet.jsx'

export function WalletCard({ card, balance, setCardFrozen }) {
  const [open, setOpen] = useState(false)
  return (
    <CardLockSheet
      card={{ holder: card.holderName, number: card.number, expiry: card.expiry, cvc: card.cvc }}
      open={open}
      onOpenChange={setOpen}
      locked={card.frozen}
      onLockedChange={(frozen) => setCardFrozen(card.id, frozen)}
      onCopy={(field) => track('card_copy', { field })}
    >
      <Balance value={balance} />
      <button onClick={() => setOpen(true)}>Details</button>
    </CardLockSheet>
  )
}

Props

PropTypeDefaultWhat it does
card{ holder, number, expiry, cvc, kind? }—What the card and the sheet show. The card face shows only the last four digits; the sheet shows everything.
artReactNode—Replaces the default graphite card face; it fills the card and is clipped to its corners.
childrenReactNode—The screen under the card (balance, actions). It blurs and becomes inert while the sheet is open.
openboolean—Whether the details sheet is open (controlled). Pressing the card opens it.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open) => void—Called when the card, the close button, the blurred area or Escape opens or closes the sheet.
lockedboolean—Whether the card is locked (controlled). Locked frosts the card and shows the badge.
defaultLockedbooleanfalseInitial lock state when uncontrolled.
onLockedChange(locked) => void—Called when the Lock switch changes. Update your backend here, and pass locked back once it succeeds.
onCopy(field, text) => void—Called after a Copy button writes the value (spaces removed) to the clipboard; field is number, expiry or cvc.
cardWidthnumber240Width of the card in pixels; the height follows the standard card ratio.
labelsobject—Replaces built-in text: kind, show, title, close, number, expiry, cvc, copy, copied, copiedNote(field), lock, lockHint, lockedHint, locked. Shallow-merged over the English defaults.
...restHTMLAttributes—Other attributes go to the root; set its size through style or a class (the sheet needs about 230px under the shrunken card).

Accessibility

  • The card is a native button with aria-expanded, named by labels.show (plus labels.locked when locked).
  • The sheet is a dialog labelled by its title; focus moves into it on open and returns to the element that opened it on close. Escape and the close button close it.
  • While the sheet is open the card and the screen content are inert, so keyboard and screen-reader focus stay in the sheet.
  • Each copy button is an icon button named "Copy: <field>" (then "Copied: <field>"); a status region announces what was copied.
  • The Lock control is a native checkbox with role switch inside its label, so the whole row toggles it.
  • Reduced motion shows the sheet, blur and frost at once; nothing tips, rises or glints.

Motion

Open: card tip 620ms ease-out, shrink to 64% 560ms; veil 360ms; sheet 460ms ease-out after 60ms; rows 240–360ms, 160ms in and 40ms apart. Close: sheet 280ms ease-in; card 520ms fold and spring. Lock: frost 360ms, glint 900ms, badge 420ms spring after 120ms.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

CardLockSheet.jsxcard-lock-sheet.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Cards
Animated border card comes with Pro. Its preview shows once you unlock it.
Border beam comes with Pro. Its preview shows once you unlock it.
Envelope open comes with Pro. Its preview shows once you unlock it.