Updated
Folder Peek
Customize
Color
Rise44px
Fan7°
Tilt22°
Max rows5
Installation
npx shadcn@latest add https://uibrik.com/r/folder-peek.jsonInstall the packages
npm install @tabler/icons-react motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/folder-peek/folder-peek.tsx"use client"; import { useEffect, useId, useLayoutEffect, useRef, useState, type CSSProperties, type DragEvent, type KeyboardEvent as ReactKeyboardEvent, type PointerEvent, } from "react"; import { AnimatePresence, motion, useReducedMotion, useSpring, useTransform, type Transition } from "motion/react"; import { IconX } from "@tabler/icons-react"; import { cn } from "@/lib/utils"; // Folder peek. A folder with a few sheets tucked inside, each a little preview // of its file. Hovering tips the front flap forward and the sheets rise and fan // out, leaning toward the cursor. Clicking opens it: the flap drops, the // sheets fly out one after another and shrink into the thumbnails of a file // list, and the names settle in beside them. Closing files them back. // // Nothing is swapped mid-flight. The folder, the list and the sheets are all
Adds the files to
components/uibrik/folder-peek and installs @tabler/icons-react and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/folder-peek.Usage
import { FolderPeek } from "@/components/uibrik/folder-peek/folder-peek";const files = [ { name: "Brand guidelines.pdf", meta: "2.4 MB" }, { name: "Q3 roadmap.key", meta: "8.1 MB" }, // …2 more];<FolderPeek name="Launch assets" color="#a1a1aa" rise={44} fan={7} tilt={22} parallax droppable maxRows={5} files={files} onSelect={(file, index) => {}} onAdd={(files) => {}}/>Where to use Folder Peek
File managers
Previews that rise and fan out on hover show what is inside a folder without opening it.
Pairs with File Card
Grouped documents
A folder that flies its files out into a list suits landing pages for document products.
Upload targets
Taking files dropped onto it makes the folder a clear drag-and-drop destination.
Pairs with File Dropzone
Props
FolderPeek- name
- Type string
- "Launch assets"
- Folder name, under the folder and atop the list.
- color
- Type string
- "#a1a1aa"
- Folder colour. The back is drawn a shade darker, the flap a shade lighter.
- rise
- Type number
- 44
- How far the sheets rise on hover.
- fan
- Type number
- 7
- How far the outer sheets turn as they fan.
- tilt
- Type number
- 22
- How far the front flap tips forward on hover.
- parallax
- Type boolean
- true
- Lean the fanned sheets toward the cursor.
- droppable
- Type boolean
- true
- Accept files dropped on the folder or the open list.
- maxRows
- Type number
- 5
- Rows the open list shows before it scrolls.
- files
- Type { name: string; meta?: string; kind?: "doc" | "slides" | "image" | "text"; preview?: string }[]
- 4 sample files
- Files on mount, newest first. The first three are drawn as sheets, previewed by kind (inferred from the extension); `preview` swaps the drawn preview for your own image.
- onSelect
- Type (file, index) => void
- –
- Called when a row in the open list is picked.
- onAdd
- Type (files) => void
- –
- Called with files dropped in from the desktop, or dragged with the application/x-folder-file type.
- className
- Type string
- –
- Classes for the wrapper.