Skip to content

FileListToolbar

FileListToolbar is a two-slot bar (left and right) for showing file count and a list/grid view toggle. Both slots are fully replaceable: pass null to hide a slot or a custom ReactNode to override the default sub-component.

3 files added
import { FileListToolbar } from "@hyperserve/upload-react";
<FileListToolbar />
PropTypeDefaultDescription
leftReactNode | nullFileCountLeft slot content
rightReactNode | nullViewToggleRight slot content
showFileCountbooleantrueShow default file count in left slot
showViewTogglebooleantrueShow default view toggle in right slot
styleCSSPropertiesnoneContainer styles
classNamestringnoneContainer class

Shows "N files added" by default. Accepts a label render prop:

4 videos
<FileListToolbar
left={
<FileListToolbar.FileCount
label={(count) => `${count} video${count !== 1 ? "s" : ""}`}
/>
}
/>

List/grid toggle buttons. Requires a ViewModeProvider ancestor. Accepts a children render prop for custom toggle UI:

<FileListToolbar.ViewToggle>
{({ viewMode, setViewMode }) => (
<select
value={viewMode}
onChange={(e) => setViewMode(e.target.value as "list" | "grid")}
>
<option value="list">List</option>
<option value="grid">Grid</option>
</select>
)}
</FileListToolbar.ViewToggle>