仕組み
The tile is one button. Its drawing sits in a box that already reserves the headroom the fan needs, so the tile never changes size and never covers what is above it. A darker back panel with a sloped tab, up to three white sheets and a front flap in the folder colour are stacked spans. When the folder opens, the sheets rise and spread to the sides by about an eighth of the folder's width, turning −12°, −1° and 10°, each 45ms after the one behind it on a 560ms spring; the front flap tips forward with rotateX(−28°) under perspective, a sheen brightens on it, and the shadow underneath widens and fades a little. Leaving lets everything settle back together in 380ms.
向いている場面
- Folder grids in a file manager, a shared drive or an attachments panel.
- Collections that hold mixed documents: receipts, contracts, photo sets.
- A drop target: pin open while a file is dragged over it.
向かない場面
- Long lists of folders where names and dates matter more: use a list or a table.
- A single file: show its own thumbnail.
- Dense toolbars or sidebars where a 150px tile does not fit.
使い方
import { FileFolder } from './FileFolder.jsx'
export function SharedFolders({ folders, navigate }) {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>
{folders.map((f) => (
<FileFolder
key={f.id}
name={f.name}
count={f.fileCount}
size={f.sizeLabel}
tone={f.colour}
previews={['doc', 'image', 'table']}
open={f.id === dragOverId}
onOpen={() => navigate(`/files/${f.id}`)}
/>
))}
</div>
)
}プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
name | string | — | Folder name, shown under the drawing and used in the button's accessible name. |
count | number | — | Number of files, written through labels.files. |
size | string | — | Total size, already formatted (for example '3.1 MB'). |
previews | ('doc' | 'image' | 'table' | 'receipt' | ReactNode)[] | ['doc', 'image', 'table'] | Up to three sheets, back to front. A keyword draws tiny placeholder content; an element (a real thumbnail, say) fills the sheet instead. |
tone | 1–8 | 1 | Chart colour of the folder; the back panel is a darker shade of it. |
open | boolean | false | Pins the fanned state, for example while the folder is selected or a file is dragged over it. |
onOpen | (event) => void | — | Called on click, tap, Enter or Space. |
folderSize | 'sm' | 'md' | 'lg' | 'md' | Width of the drawing: 120, 150 or 200px. |
labels | object | — | Replaces built-in text: files(n) for the count, open(name) for the accessible name. Shallow-merged over the English defaults. |
...rest | ButtonHTMLAttributes | — | Other attributes go to the root <button>. |
アクセシビリティ
- The tile is a native button named by labels.open(name) plus the count and size; the drawing is aria-hidden.
- Keyboard focus fans the sheets the same way hover does and shows a focus ring; Enter or Space opens.
- On touch, holding a finger on the folder fans it out, and lifting it opens; the system long-press menu is suppressed only while it is fanned.
- Name and details are at least 13px, and long names end in an ellipsis.
- Reduced motion lifts the sheets straight up a little at once, with no turning, spring, stagger or tipping flap.
モーション
Fan out: sheets 560ms spring with a slight overshoot, 45ms apart from the back; front flap rotateX(−28°) 560ms spring; shadow widens 10% and fades to 70%. Settle: everything 380ms ease-out together. Press: the drawing scales to 97% in 100ms.
プロジェクトに追加
Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。
FileFolder.jsxfile-folder.csstokens.cssREADME.md
2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。







