Updated
File Card
Q4 planning.pdf
PDF · 2.4 MBv2
Edited 2h ago by Ava
Customize
Curl46px
Installation
npx shadcn@latest add https://uibrik.com/r/file-card.jsonInstall the packages
npm install motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/file-card/file-card.tsx"use client"; import { useEffect, useState, type ReactNode } from "react"; import { AnimatePresence, motion, useReducedMotion, useSpring, useTransform } from "motion/react"; import { cn } from "@/lib/utils"; const EASE_OUT = [0.23, 1, 0.32, 1] as const; const SPRING = { type: "spring", duration: 0.5, bounce: 0 } as const; const FOCUS = "outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-400 dark:focus-visible:outline-zinc-500"; const SHELL = "edge-outer rounded-3xl bg-muted/70 p-1.5 dark:bg-muted/60"; const PANEL = "edge-inner rounded-[18px] bg-background"; function CardShell({ title, meta, actions, footer, className, panelClassName,
Adds the files to
components/uibrik/file-card and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/file-card.Usage
import { FileCard } from "@/components/uibrik/file-card/file-card";const versions = [ { author: "Maya", time: "Mon" }, { author: "Ava", time: "2h ago" },];<FileCard name="Q4 planning.pdf" meta="PDF · 2.4 MB" curl={46} versions={versions} onOpen={() => {}}/>Where to use File Card
Document managers
A corner that curls on hover previews the next page without opening the file.
Pairs with Folder Peek
Version history
Older versions stacked behind the sheet show a document has history at a glance.
Reports and contracts
A realistic sheet makes an invoice or report feel like a real document on a landing page.
Props
FileCard- name
- Type string
- "Q4 planning.pdf"
- File name, on the shell.
- meta
- Type string
- "PDF · 2.4 MB"
- Muted, beside the name: type and size.
- curl
- Type number
- 46
- How far the corner curls on hover. Pressing curls it further.
- versions
- Type { author?: string; time?: string; preview?: string }[]
- 2 sample versions
- Versions on mount, oldest first. The last is on top; preview swaps the drawn page for an image.
- onOpen
- Type () => void
- –
- Called when the sheet is clicked.
- className
- Type string
- –
- Classes for the card.