Chonky v2.1.0 Docs
IntroductionInstallation & usageFile Browser demosMigrating from 1.xFAQ
Basics

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

instanceId:string
PropertyOptional

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.

files:FileArray
PropertyRequired

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.

folderChain:Nullable<FileArray>
PropertyOptional

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.

fileActions:Nullable<FileAction[]>
PropertyOptional

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.

onFileAction:Nullable<GenericFileActionHandler<ChonkyActionUnion>>
PropertyOptional

An action handler that will be called every time a file action is dispatched.

thumbnailGenerator:Nullable<ThumbnailGenerator>
PropertyOptional

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.

doubleClickDelay:number
PropertyOptional

Maximum delay between the two clicks in a double click, in milliseconds.

disableSelection:boolean
PropertyOptional

The flag that completely disables file selection functionality. If any handlers depend on file selections, their input will always have empty file selections.

disableDefaultFileActions:boolean | string[]
PropertyOptional

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.

disableDragAndDrop:boolean
PropertyOptional

The flag that completely disables drag & drop functionality for this instance of Chonky.

disableDragAndDropProvider:boolean
PropertyOptional

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.

defaultSortActionId:Nullable<string>
PropertyOptional

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.

defaultFileViewActionId:string
PropertyOptional

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.

clearSelectionOnOutsideClick:boolean
PropertyOptional

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.

iconComponent:ElementType<ChonkyIconProps>
PropertyOptional

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.

darkMode:boolean
PropertyOptional

Enables dark mode theme.

i18n:I18nConfig
PropertyOptional

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.

If you have a question, want to request a feature or report a bug, please create an issue on GitHub. You can also report inaccurate or unclear documentation on Chonky's Discord server.