clickworks
Works / Content

Card Drawer

A portfolio or project list as a real card file. Click the drawer and it slides open, click a card and it lifts out along one smooth arc to show its image, click again and it files back in its place. Each card can link to its page. It's plain CSS 3D, with soft shadows computed so they stay sharp on every phone.

Pro1 file0 dependencies14 kB gzippedRenders on the serverKeyboard and screen reader

Install

npx shadcn@latest add @clickworks-pro/card-drawer

Needs your Pro token, set up once in Pro access.

Usage

"use client"

import { CardDrawer } from "@/components/clickworks/card-drawer/react/CardDrawer"

export function Work() {
  return (
    <div style={{ width: 480, height: 600 }}>
      <CardDrawer
        name="Your Name"
        cards={[
          { title: "Brand", image: { src: "/work/brand.jpg", alt: "Brand system" }, link: "/work/brand" },
          { title: "App", image: { src: "/work/app.jpg", alt: "Banking app" }, link: "/work/app" },
        ]}
      />
    </div>
  )
}

Props

cards
{ title?, image?: { src, alt? }, link? }[]

Up to six cards. Each has a title on its tab, an image and an optional link.

name
string

Engraved on the drawer front. Leave empty for none.

Default "Ada Voss"

start
"closed" | "open" | "out"

How it looks on load: closed, open, or open with the first card lifted.

Default "closed"

theme
"auto" | "light" | "dark"

Auto follows the page (its background, data-theme or dark class), then the device.

Default "auto"

light / dark
{ drawer?, card?, title?, number?, engraving?, rivet?, shadow? }

Colours for each theme. Every face and shadow is shaded from them.

view
{ tilt?, turn? }

The camera: how far you look down on the drawer and how far it's turned.

Default 30, 22

cardStyle
{ radius?, thickness?, border?, numbers?, rivet? }

Card corners, board thickness, image border, tab numbers and rivets.

shadows
{ floor?, cards?, held? }

Strength of the floor, card and held-card shadows.

Default 1, 1, 1

duration
number

Seconds for a card to lift out.

Default 1.35

newTab
boolean

Open card links in a new tab.

Default false

sound / haptics
boolean

Soft paper sounds and a light tap on phones.

Default true

Events

onOpen
() => void

The drawer opened.

onClose
() => void

The drawer closed.

onLift
() => void

A card was lifted out.

onCardClick
() => void

A lifted card was clicked.

Styling

It fills its box and keeps a 580 by 720 shape. Colours come in through the light and dark props, and the tab and name fonts through labelFont and nameFont.

Behaviour and accessibility

  • The drawer is a real button, and the cards a list you move through with the arrow keys. Enter lifts a card, Escape files it back.
  • Each change is announced to screen readers.
  • With reduced motion the cards move without the arc.

Files

react/CardDrawer.tsxReact component