File Manager

File browser with breadcrumb navigation, folders that slide in from the side you travel, grid/list views, click / Cmd-Ctrl-click / Shift-click range selection with arrow-key movement, kind-tinted file icons, a sort menu, a storage usage meter, and a drop overlay that adds dragged-in files to the open folder.

Preview

File Manager preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/file-manager
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

root
FileNode

The root folder. Dropped files are added to the internal copy.

—
path?
string[]

Controlled path: ids from the root's child down to the open folder.

—
defaultPath?
string[]
[]
onPathChange?
((path: string[]) => void)
—
view?
"grid" | "list"
—
defaultView?
"grid" | "list"
grid
onViewChange?
((view: FileView) => void)
—
selection?
string[]

Controlled selection (ids in the open folder).

—
defaultSelection?
string[]
[]
onSelectionChange?
((ids: string[]) => void)
—
defaultSort?
FileSort
{ key: "name", direction: "asc" }
onOpenFile?
((file: FileNode, path: string[]) => void)

Fires when a file (not a folder) is opened by double-click or Enter.

—
onUpload?
((files: File[], folderId: string) => void)

Fires with dropped files and the folder they landed in.

—
storage?
{ used: number; total: number; }

Storage meter in bytes. Omit to hide the footer meter.

—
locale?
string

Default "en-US" so server and client agree.

en-US
className?
string
—

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated