Dropzone
Dropzone is a component that allows you to drag-and-drop files into a container to process them.
Powered by
Installation
npx kibo-ui@latest add dropzone
Features
- Drag and drop files to upload
- Customize the empty state and content
- Intelligently handle file types, sizes, and counts
- Show file names and sizes in a human readable format
- Handle errors and reject files
- Disable the dropzone when needed
- Customize the appearance with className
- Show file previews for images
- Replace existing files by dragging new ones
- Context provider for accessing dropzone state
Examples
With max and min sizes
Multiple files
Images only
With custom empty state
Showing an image preview
Props
The dropzone component is made up of the following subcomponents:
Dropzone
Prop | Type | Default |
---|---|---|
multiple? | boolean | - |
onDragEnter? | DragEventHandler<HTMLElement> | - |
onDragOver? | DragEventHandler<HTMLElement> | - |
onDragLeave? | DragEventHandler<HTMLElement> | - |
accept? | Accept | - |
minSize? | number | - |
maxSize? | number | - |
maxFiles? | number | - |
preventDropOnDocument? | boolean | - |
noClick? | boolean | - |
noKeyboard? | boolean | - |
noDrag? | boolean | - |
noDragEventsBubbling? | boolean | - |
disabled? | boolean | - |
onDropAccepted? | (<T extends File>(files: T[], event: DropEvent) => void) | - |
onDropRejected? | ((fileRejections: FileRejection[], event: DropEvent) => void) | - |
getFilesFromEvent? | ((event: DropEvent) => Promise<(File | DataTransferItem)[]>) | - |
onFileDialogCancel? | (() => void) | - |
onFileDialogOpen? | (() => void) | - |
onError? | ((err: Error) => void) | - |
validator? | (<T extends File>(file: T) => FileError | readonly FileError[] | null) | - |
useFsAccessApi? | boolean | - |
autoFocus? | boolean | - |
src? | File[] | - |
className? | string | - |
onDrop? | ((acceptedFiles: File[], fileRejections: FileRejection[], event: DropEvent) => void) | - |
children? | ReactNode | - |
DropzoneEmptyState
Prop | Type | Default |
---|---|---|
children? | ReactNode | - |
DropzoneContent
Prop | Type | Default |
---|---|---|
children? | ReactNode | - |
Dialog Stack
Composable stacked dialogs, useful for creating a wizard, nested form or multi-step process. It provides a consistent layout and styling for each dialog, and includes navigation components to move between them.
Editor
The Editor component is a powerful and flexible text editor that allows you to create and edit rich text content.