🚀Ship faster with UI-Layouts Pro

Work With Us

File Upload

A datetime picker built on top of shadcn-ui and no additional library needed.

Thanks to Yerfa

Img Preview

Chat

Installation

npx uilayouts@latest add file-upload

FileUploader Props

PropTypeDefaultDescription
valueFile[] | nullnullThe array of uploaded files.
reSelectbooleanundefinedIf true, allows reselecting files when maxFiles is 1.
onValueChange(value: File[] | null) => void-Callback triggered when the file selection changes.
dropzoneOptionsDropzoneOptions{}Configuration options for the dropzone, such as maxFiles, maxSize, and accept file types.
orientation'horizontal' | 'vertical''vertical'Sets the layout direction of the file uploader.
childrenReact.ReactNodeundefinedComponents or elements to be rendered within the file uploader.
classNamestringundefinedAdditional CSS classes for custom styling.
dir'rtl' | 'ltr' | undefinedundefinedSets text directionality, affecting navigation and layout in horizontal mode.
refReact.Ref<HTMLDivElement>undefinedReference to the uploader’s root div element.

FileUploaderContext

The FileUploaderContext is a context containing the following properties:

PropertyTypeDescription
dropzoneStateDropzoneStateThe state object provided by react-dropzone, used for handling file drag-and-drop behavior.
isLOFbooleanIndicates if the maximum number of files has been reached.
isFileTooBigbooleanIndicates if the rejected file exceeds the maximum allowed size.
removeFileFromSet(index: number) => voidFunction to remove a file at a specific index from the current selection.
activeIndexnumberThe index of the currently selected file in the list, used for navigation.
setActiveIndexDispatch<SetStateAction<number>>Function to set the active index.
orientation'horizontal' | 'vertical'Defines whether files are displayed horizontally or vertically.
direction'rtl' | 'ltr' | undefinedSpecifies the text direction; affects keyboard navigation in horizontal mode.