File Browser
A generic, selectable file and folder browser with thumbnail, list and details views, kind-aware icons, image/video previews, drag-and-drop upload with filters and full keyboard navigation — for asset libraries, pickers and Drive / OneDrive style explorers.
Basic Usage
Files in thumbnail, list and details views
A selectable browser with file-kind icons, image/video thumbnails, inline video playback, per-item actions and full keyboard navigation. Toggle the view from the toolbar.
import { FileBrowser } from 'fluxo-ui';
import type { FileBrowserItem, FileBrowserView } from 'fluxo-ui';
const [selected, setSelected] = useState<string[]>([]);
const [view, setView] = useState<FileBrowserView>('thumbnail');
<FileBrowser
items={files}
view={view}
onViewChange={setView}
showViewSwitcher
selectedIds={selected}
onSelectionChange={setSelected}
videoPreview
onItemOpen={(item) => console.log('open', item.name)}
renderActions={(item) => <Button label="Open" size="xs" layout="plain" />}
/>Upload & Filters
Drag-and-drop upload with type, size and count filters
Drop files anywhere on the browser, or use the empty-state button. accept, maxFileSize and maxSelection reject files and report why.
import { FileBrowser } from 'fluxo-ui';
import type { FileBrowserItem, RejectedFile } from 'fluxo-ui';
<FileBrowser
items={items}
enableUpload
multiple
accept="image/*,.pdf"
maxFileSize={5 * 1024 * 1024}
maxSelection={8}
uploadHint="Drop images or PDFs (max 5 MB)"
onUpload={(accepted, rejected) => {
addFiles(accepted);
rejected.forEach((r) => console.warn(r.file.name, 'rejected:', r.reason));
}}
/>Folder Navigation
Folder navigation
Open a folder with Enter or double-click to drill in; the breadcrumb in the toolbar walks back out. The same pattern powers Google Drive / OneDrive style explorers.
const [path, setPath] = useState<string[]>([]);
<FileBrowser
view="details"
items={currentItems}
toolbarStart={<Breadcrumb items={crumbs} onItemClick={navigate} />}
onItemOpen={(item) => {
if (item.kind === 'folder') setPath((p) => [...p, item.id]);
}}
/>Import
import { FileBrowser } from 'fluxo-ui';
import type { FileBrowserProps, FileBrowserItem, FileBrowserView } from 'fluxo-ui';Props
itemsreqFileBrowserItem[]Items to render. Each: { id, name, kind?, subtitle?, thumbnailUrl?, previewUrl?, mimeType?, size?, modified?, badge?, loading?, disabled?, selectable?, meta?, data? }. When kind is omitted it is inferred from mimeType then the file extension.
itemsreqFileBrowserItem[]Items to render. Each: { id, name, kind?, subtitle?, thumbnailUrl?, previewUrl?, mimeType?, size?, modified?, badge?, loading?, disabled?, selectable?, meta?, data? }. When kind is omitted it is inferred from mimeType then the file extension.
selectedIdsstring[]Controlled selected ids. Omit to let the component manage selection internally.
selectedIdsstring[]Controlled selected ids. Omit to let the component manage selection internally.
onSelectionChange(ids: string[]) => voidCalled whenever the selection changes.
onSelectionChange(ids: string[]) => voidCalled whenever the selection changes.
view'thumbnail' | 'list' | 'details'Controlled view. Omit to use defaultView and internal state.
view'thumbnail' | 'list' | 'details'Controlled view. Omit to use defaultView and internal state.
defaultView'thumbnail' | 'list' | 'details'"'thumbnail'"Initial view when uncontrolled.
defaultView'thumbnail' | 'list' | 'details'"'thumbnail'"Initial view when uncontrolled.
onViewChange(view: FileBrowserView) => voidCalled when the view changes via the switcher.
onViewChange(view: FileBrowserView) => voidCalled when the view changes via the switcher.
availableViewsFileBrowserView[]"['thumbnail', 'list', 'details']"Which views the built-in switcher offers.
availableViewsFileBrowserView[]"['thumbnail', 'list', 'details']"Which views the built-in switcher offers.
showViewSwitcherboolean"false"Render the built-in thumbnail/list/details toggle in the toolbar.
showViewSwitcherboolean"false"Render the built-in thumbnail/list/details toggle in the toolbar.
selectableboolean"true"Whether items can be selected.
selectableboolean"true"Whether items can be selected.
multipleboolean"true"Allow selecting more than one item. Also controls whether the upload picker accepts multiple files.
multipleboolean"true"Allow selecting more than one item. Also controls whether the upload picker accepts multiple files.
maxSelectionnumberMaximum number of items selectable at once when multiple. Also caps how many dropped/picked files are accepted for upload.
maxSelectionnumberMaximum number of items selectable at once when multiple. Also caps how many dropped/picked files are accepted for upload.
thumbnailFit'cover' | 'contain'"'contain'"How each image/video thumbnail fits its box.
thumbnailFit'cover' | 'contain'"'contain'"How each image/video thumbnail fits its box.
minTileWidthnumber"160"Minimum tile width in px for the thumbnail grid.
minTileWidthnumber"160"Minimum tile width in px for the thumbnail grid.
columnsFileBrowserColumn[]"name / type / size / modified"Columns rendered in the details view. Each: { key, header, width?, align?, render? }. The 'name' column auto-grows and shows the kind icon; built-in keys size/modified/kind format automatically, others read item.meta[key].
columnsFileBrowserColumn[]"name / type / size / modified"Columns rendered in the details view. Each: { key, header, width?, align?, render? }. The 'name' column auto-grows and shows the kind icon; built-in keys size/modified/kind format automatically, others read item.meta[key].
emptyStateReact.ReactNodeCustom content shown when there are no items.
emptyStateReact.ReactNodeCustom content shown when there are no items.
renderActions(item: FileBrowserItem) => React.ReactNodeRender per-item action buttons (preview, edit, remove, download…). Shown on hover in thumbnail/list and inline in details.
renderActions(item: FileBrowserItem) => React.ReactNodeRender per-item action buttons (preview, edit, remove, download…). Shown on hover in thumbnail/list and inline in details.
renderPreview(item: FileBrowserItem, kind: FileKind) => React.ReactNodeOverride the default thumbnail/preview rendering for an item entirely.
renderPreview(item: FileBrowserItem, kind: FileKind) => React.ReactNodeOverride the default thumbnail/preview rendering for an item entirely.
renderItem(item: FileBrowserItem, ctx: FileBrowserItemContext) => React.ReactNodeFully override the tile body in thumbnail/list views. ctx exposes { kind, selected, view, toggle, open }.
renderItem(item: FileBrowserItem, ctx: FileBrowserItemContext) => React.ReactNodeFully override the tile body in thumbnail/list views. ctx exposes { kind, selected, view, toggle, open }.
onItemOpen(item: FileBrowserItem) => voidCalled on Enter or double-click — use for folder navigation or opening a preview.
onItemOpen(item: FileBrowserItem) => voidCalled on Enter or double-click — use for folder navigation or opening a preview.
onItemClick(item: FileBrowserItem) => voidCalled on single click, before selection toggles.
onItemClick(item: FileBrowserItem) => voidCalled on single click, before selection toggles.
videoPreviewboolean"false"Play video items inline (with controls) when their thumbnail is clicked. Falls back to a poster image with a play overlay.
videoPreviewboolean"false"Play video items inline (with controls) when their thumbnail is clicked. Falls back to a poster image with a play overlay.
enableUploadboolean"false"Enable drag-and-drop file upload onto the browser and a hidden file input opened via the empty-state button.
enableUploadboolean"false"Enable drag-and-drop file upload onto the browser and a hidden file input opened via the empty-state button.
acceptstringComma-separated accept list applied to uploads (e.g. 'image/*,.pdf'). Files not matching are rejected with reason 'type'.
acceptstringComma-separated accept list applied to uploads (e.g. 'image/*,.pdf'). Files not matching are rejected with reason 'type'.
maxFileSizenumberMaximum size in bytes for an uploaded file. Larger files are rejected with reason 'size'.
maxFileSizenumberMaximum size in bytes for an uploaded file. Larger files are rejected with reason 'size'.
onUpload(files: File[], rejected: RejectedFile[]) => voidCalled after a drop or pick with the accepted files and the rejected ones (each carrying reason 'type' | 'size' | 'count').
onUpload(files: File[], rejected: RejectedFile[]) => voidCalled after a drop or pick with the accepted files and the rejected ones (each carrying reason 'type' | 'size' | 'count').
uploadHintReact.ReactNodeMessage shown in the drop overlay while dragging files over the browser.
uploadHintReact.ReactNodeMessage shown in the drop overlay while dragging files over the browser.
classNamestringAdditional class for the container.
classNamestringAdditional class for the container.
styleReact.CSSPropertiesInline styles for the outer container (e.g. a minHeight so the drop zone stays usable when empty).
styleReact.CSSPropertiesInline styles for the outer container (e.g. a minHeight so the drop zone stays usable when empty).
ariaLabelstring"'Files'"Accessible label for the collection/grid container.
ariaLabelstring"'Files'"Accessible label for the collection/grid container.
toolbarStartReact.ReactNodeCustom content rendered at the start of the toolbar (e.g. breadcrumb, search).
toolbarStartReact.ReactNodeCustom content rendered at the start of the toolbar (e.g. breadcrumb, search).
toolbarEndReact.ReactNodeCustom content rendered at the end of the toolbar, before the view switcher.
toolbarEndReact.ReactNodeCustom content rendered at the end of the toolbar, before the view switcher.
Features
Three views
Thumbnail grid, compact list and a columned details view — switch built-in or control externally.
Kind-aware icons
Image, video, audio, PDF, document, text, code and archive kinds inferred from mime type or extension.
Media previews
Image and video thumbnails with inline playback, plus a renderPreview hook to override any tile.
Drag-and-drop upload
Drop files onto the browser or pick them, with accept, maxFileSize and maxSelection filters.
Folder navigation
Open folders via Enter / double-click and pair with a breadcrumb for Drive-style explorers.
Accessible
Listbox / grid roles, roving tab index, arrow / Home / End navigation and Space / Enter activation.