组件

Folder

A manila file folder that is also a set of tabs: a row of paper tabs standing on a sheet of the same paper. The active tab is the folder's own color and runs down into the body, so tab and folder are one piece; the others stand a little lower and darker. It is Radix Tabs underneath.

安装

terminal
npx shadcn@latest add @wobko/folder

第一次使用?先把 registry 加进 components.json。 如何安装

示例

A folder with tabs

The front tab is the folder's color and runs into the body; the others stand behind it. Arrow keys move between tabs; Home and End jump.

Manila, yellow, white

The folder is whatever its stock is: manila, a legal-pad yellow or white card. A folder with one tab is just a labeled folder.

Controlled

The open tab is your state: `value` and `onValueChange`, as on Tabs. Here a button jumps to the next one.

Project files

A real page: a project's tasks, notes and files as tabs on one folder, with a form inside the open panel. Each panel is ordinary DOM; only the open one is in the page.

API 参考

Folder

The Radix Tabs root, a flex column at most 42 rem wide. It takes the Tabs props (`value`, `defaultValue`, `onValueChange`, `dir`, `activationMode`) except `orientation`: a folder's tabs stand along its top edge, so it is always horizontal (Left / Right move between tabs; Up / Down do not).

属性类型默认值说明
stockStockName"kraft"What tabs and body are made of: kraft (manila), sticky-yellow, paper, index-card ...

FolderTab

One tab (`role="tab"`), 2.25 rem high (2 rem compact, 1.75 rem calm), its paper drawn behind the label. The active tab is the front one; a disabled tab is only a dashed pencil outline. Arrow keys, Home and End move between tabs; the label is real text.

属性类型默认值说明
valuestring-Which panel it opens.
disabledboolean-Skipped by the arrow keys; drawn as a dashed ghost.

FolderContent

The panel a tab opens onto (`role="tabpanel"`), a Paper in the folder's stock, square to the desk. Only the active panel is in the page.

属性类型默认值说明
valuestring-The tab it belongs to.
creasebooleantrueThe fold across the top of the sheet.
tape / fastener / edge / shadow / seed / tiltPaper props-As on any sheet (tilt defaults to none, so the tabs stay square to the body).

无障碍

  • Radix Tabs gives the whole pattern: `tablist` / `tab` / `tabpanel` roles, `aria-selected`, `aria-controls`, roving focus with arrow keys, Home and End (Left and Right swap in RTL), and a disabled tab skipped by the keyboard.
  • The drawn tab paper, the crease and the shadows are aria-hidden. The active tab is also `aria-selected` and bold, so it never depends on color alone. Tab text is ink: 9:1 on the manila, 7.5:1 on a tab standing behind it.
  • Windows high contrast replaces the drawn tabs with bordered buttons (the tabs carry a real border until their drawing exists and in forced colors), and the active tab fills with the system highlight color. The open panel is a tab stop and shows the standard focus ring.

源码

CLI 会复制进你项目的文件。

正在加载源码