$ rezi
Widgets

FilePicker

File picker widget for browsing and selecting workspace files. Rezi core does not read the filesystem; you provide the file tree data.

File picker widget for browsing and selecting workspace files. Rezi core does not read the filesystem; you provide the file tree data.

Usage

ui.filePicker({
  id: "picker",
  rootPath: state.rootPath,
  data: state.data,
  selectedPath: state.selectedPath,
  expandedPaths: state.expandedPaths,
  onSelect: (path) => app.update((s) => ({ ...s, selectedPath: path })),
  onToggle: (path, expanded) =>
    app.update((s) => ({
      ...s,
      expandedPaths: expanded
        ? [...s.expandedPaths, path]
        : s.expandedPaths.filter((p) => p !== path),
    })),
  onOpen: (path) => openFile(path),
})

Props

PropTypeDefaultDescription
idstringrequiredWidget identifier
rootPathstringrequiredRoot path label
dataFileNode | FileNode[]requiredFile tree data
selectedPathstring-Selected file path
expandedPathsstring[]requiredExpanded directory paths
modifiedPathsstring[]-Modified file paths
stagedPathsstring[]-Staged file paths
filterstring-Glob filter
showHiddenboolean-Show hidden files
multiSelectboolean-Enable multi-select
selectionstring[]-Selected paths (multi-select)
onSelect(path) => voidrequiredSelection callback
onToggle(path, expanded) => voidrequiredExpand/collapse callback
onOpen(path) => voidrequiredOpen callback
onSelectionChange(paths) => void-Multi-select change callback

Notes

  • FileNode includes name, path, type, and optional children and status.

On this page