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/video-uploader-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
stylesFileListToolbarStylesnoneSlot map applied to internal elements (see Slots below)

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>

Pass a styles slot map to theme internal elements. Slots merge over defaults; local style props win over slots. See Theming for the canonical merge-order explanation.

SlotTargets
rootThe outer toolbar container
fileCountThe default FileCount text
viewToggleThe ViewToggle button group container
viewToggleButtonEach view toggle button (inactive state)
viewToggleButtonActiveMerged on top of viewToggleButton for the active button

The React Native FileListToolbar exposes the same slots plus two extras for the inner <Text> of each button. Web doesn’t need them because it uses inline icon children:

  • viewToggleText
  • viewToggleTextActive
<FileListToolbar
styles={{
root: { padding: 12, background: "#0f172a" },
fileCount: { color: "#cbd5e1" },
viewToggleButton: { background: "#1e293b", color: "#94a3b8" },
viewToggleButtonActive: { background: "#38bdf8", color: "#0f172a" },
}}
/>