FileBrowser
component
FileBrowserProps
Interface
Props for the FileBrowser
component that is exposed to library users.
Source code on GitHub: src/types/file-browser.types.ts
An ID used to identify this particular Chonky instance. Useful when there are multiple Chonky instances on the same page, and they need to interact with each other. When no instance ID is provided, a random hash is used in its place. Note that instance ID should remain static. Any changes to "instanceId" after initial FileBrowser mount will be ignored.
List of files that will be displayed in the main container. The provided value
must be an array, where each element is either null
or an object that
satisfies the FileData
type. If an element is null
, a loading placeholder
will be displayed in its place.
The current folder hierarchy. This should be an array of files
, every
element should either be null
or an object of FileData
type. The first
element should represent the top-level directory, and the last element
should be the current folder.
An array of file actions that will be available to your users at runtime.
These actions will be activated in addition to default actions. If you don't
want default file actions to be enabled, see disableDefaultFileActions
prop.
An action handler that will be called every time a file action is dispatched.
The function that determines the thumbnail image URL for a file. It gets a file
object as the input, and should return a string
or null
. It can also
return a promise that resolves into a string
or null
.
Maximum delay between the two clicks in a double click, in milliseconds.
The flag that completely disables file selection functionality. If any handlers depend on file selections, their input will always have empty file selections.
The value that determines what default file actions will be disabled. You can
set this to true
to disable all default file actions, or explicitly pass an
array of default file action IDs that you want to disable.
The flag that completely disables drag & drop functionality for this instance of Chonky.
The flag that is used to disable react-dnd
context provider inside of this
instance of Chonky, while keeping other drag & drop functionality in tact.
Useful when you want to provide your own react-dnd
context.
The ID of the sort-selector-setting action to activate by default. This field can be used to specify the default sort order in Chonky.
The ID of the file-view-setting action to activate by default. This field can be used to specify the default file view in Chonky.
Determines whether the file selection should be cleared when user clicks anywhere outside of Chonky. By default, selection is cleared on outside click unless the click target is a button.
Icon component that will be used in this instance of Chonky. Note that this will only affect the current instance of Chonky. If you wanna set the icon component for all Chonky instances, use the global config.
Enables dark mode theme.
Configuration for the react-intl
i18n library. Chonky provides some default
values, e.g. locale
and defaultLocale
are set to en
. Any settings you
specify here will override the defaults.