File browser

Explores a supplied file hierarchy through folders, breadcrumbs, search, and list or grid views.

The working files

Use it for

  • Browsing a supplied file tree and choosing a file.
  • Folder-local search with consistent selection in list and grid views.

Not for

  • Direct filesystem access or cloud storage sync; the application supplies data and actions.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { FileBrowser } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/file-browser.

2. Vendor the source

npx @noorddev/vlak-cli add file-browser

The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/file-browser.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { FileBrowser } from "@noorddev/vlak-react";

<FileBrowser entries={[{ id: "design", name: "Design", kind: "folder", children: [{ id: "cover", name: "Cover.pdf", kind: "file", size: "1.2 MB" }] }]} onOpen={openFile} />

FileBrowser

A controlled file collection with folder tree, breadcrumbs, search, and list or grid views.

PropTypeDefaultDescription
entriesrequiredBrowserEntry[]
labelstring"Files"
rootLabelstring"Files"Visible root-folder name, separate from the accessible browser label.
valuestring
defaultValuestring
onValueChange(id: string) => void
folderstring | null
defaultFolderstring | nullnull
onFolderChange(id: string | null) => void
onOpen(entry: BrowserEntry) => void

Also accepts Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onSelect">.

KeysDoes
Arrow keys, Home, End, type-aheadNavigates the folder tree using its roving focus behavior.
Tab, Enter, SpaceUses breadcrumbs, selects files, switches view, and activates Open selected.
<div class="rs-file-browser" role="region" aria-label="Files"><nav aria-label="Folder breadcrumbs">Files</nav><ul class="rs-file-browser-list"><li><button class="rs-file-browser-item" type="button" aria-pressed="false">Cover.pdf</button></li></ul></div>
.rs-file-browser.rs-file-browser-toolbar.rs-file-browser-breadcrumbs.rs-file-browser-path.rs-file-browser-crumb-item.rs-file-browser-crumb.rs-file-browser-crumb-current.rs-file-browser-action.rs-file-browser-body.rs-file-browser-tree.rs-file-browser-content.rs-file-browser-list.rs-file-browser-grid.rs-file-browser-name.rs-file-browser-meta.rs-file-browser-empty.rs-file-browser-view-active.rs-file-browser-item.rs-file-browser-tile.rs-file-browser-selected