Custom Content
Supply your own text and icons within the dropzone.
Disabled
Button Only
Clear Files
- example.png4 bytes
- example.png4 bytes
Direction
API Reference
Root
flex flex-col gap-2 w-full data-disabled:disabled| Prop | Default | Type |
|---|---|---|
name | — | string | undefined The name of the underlying file input |
ids | — | Partial<{ root: string; dropzone: string; hiddenInput: string; trigger: string; label: string; item: (id: string) => string; itemName: (id: string) => string; itemSizeText: (id: string) => string; itemPreview: (id: string) => string; }> | undefined The ids of the elements. Useful for composition. |
translations | — | IntlTranslations | undefined The localized messages to use. |
accept | — | Record<string, string[]> | FileMimeType | FileMimeType[] | undefined The accept file types |
disabled | — | boolean | undefined Whether the file input is disabled |
required | — | boolean | undefined Whether the file input is required |
allowDrop | true | boolean | undefined Whether to allow drag and drop in the dropzone element |
maxFileSize | Infinity | number | undefined The maximum file size in bytes |
minFileSize | 0 | number | undefined The minimum file size in bytes |
maxFiles | 1 | number | undefined The maximum number of files |
preventDocumentDrop | true | boolean | undefined Whether to prevent the drop event on the document |
validate | — | ((file: File, details: FileValidateDetails) => FileError[] | null) | undefined Function to validate a file |
defaultAcceptedFiles | — | File[] | undefined The default accepted files when rendered. Use when you don't need to control the accepted files of the input. |
acceptedFiles | — | File[] | undefined The controlled accepted files |
onFileChange | — | ((details: FileChangeDetails) => void) | undefined Function called when the value changes, whether accepted or rejected |
onFileAccept | — | ((details: FileAcceptDetails) => void) | undefined Function called when the file is accepted |
onFileReject | — | ((details: FileRejectDetails) => void) | undefined Function called when the file is rejected |
capture | — | "user" | "environment" | undefined The default camera to use when capturing media |
directory | — | boolean | undefined Whether to accept directories, only works in webkit browsers |
invalid | — | boolean | undefined Whether the file input is invalid |
transformFiles | — | ((files: File[]) => Promise<File[]>) | undefined Function to transform the accepted files to apply transformations |
locale | "en-US" | string | undefined The current locale. Based on the BCP 47 definition. |
dir | "ltr" | "ltr" | "rtl" | undefined The document's text/writing direction. |
getRootNode | — | (() => ShadowRoot | Node | Document) | undefined A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Provider
| Prop | Default | Type |
|---|---|---|
value | — | FileUploadApi<PropTypes> |
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Context
| Prop | Default | Type |
|---|---|---|
children | — | (fileUpload: FileUploadApi<PropTypes>) => ReactNode |
Label
label-text| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"label">) => Element) | undefined Render the element yourself |
Dropzone
card px-4 py-10 border border-dashed border-surface-200-800 flex flex-col justify-center items-center gap-2 data-dragging:preset-tonal| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Trigger
btn preset-filled| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"button">) => Element) | undefined Render the element yourself |
HiddenInput
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"input">) => Element) | undefined Render the element yourself |
ItemGroup
flex flex-col gap-2| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"ul">) => Element) | undefined Render the element yourself |
Item
grid grid-cols-[auto_1fr_auto] gap-4 items-center preset-tonal px-4 py-2 rounded| Prop | Default | Type |
|---|---|---|
file | — | File |
type | — | ItemType | undefined |
element | — | ((attributes: HTMLAttributes<"li">) => Element) | undefined Render the element yourself |
ItemName
text-sm| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
ItemSizeText
text-xs opacity-60| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
ItemDeleteTrigger
btn-icon| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"button">) => Element) | undefined Render the element yourself |
Root
flex flex-col gap-2 w-full data-disabled:disabled| Prop | Default | Type |
|---|---|---|
name | — | string | undefined The name of the underlying file input |
ids | — | Partial<{ root: string; dropzone: string; hiddenInput: string; trigger: string; label: string; item: (id: string) => string; itemName: (id: string) => string; itemSizeText: (id: string) => string; itemPreview: (id: string) => string; }> | undefined The ids of the elements. Useful for composition. |
translations | — | IntlTranslations | undefined The localized messages to use. |
accept | — | Record<string, string[]> | FileMimeType | FileMimeType[] | undefined The accept file types |
disabled | — | boolean | undefined Whether the file input is disabled |
required | — | boolean | undefined Whether the file input is required |
allowDrop | true | boolean | undefined Whether to allow drag and drop in the dropzone element |
maxFileSize | Infinity | number | undefined The maximum file size in bytes |
minFileSize | 0 | number | undefined The minimum file size in bytes |
maxFiles | 1 | number | undefined The maximum number of files |
preventDocumentDrop | true | boolean | undefined Whether to prevent the drop event on the document |
validate | — | ((file: File, details: FileValidateDetails) => FileError[] | null) | undefined Function to validate a file |
defaultAcceptedFiles | — | File[] | undefined The default accepted files when rendered. Use when you don't need to control the accepted files of the input. |
acceptedFiles | — | File[] | undefined The controlled accepted files |
onFileChange | — | ((details: FileChangeDetails) => void) | undefined Function called when the value changes, whether accepted or rejected |
onFileAccept | — | ((details: FileAcceptDetails) => void) | undefined Function called when the file is accepted |
onFileReject | — | ((details: FileRejectDetails) => void) | undefined Function called when the file is rejected |
capture | — | "user" | "environment" | undefined The default camera to use when capturing media |
directory | — | boolean | undefined Whether to accept directories, only works in webkit browsers |
invalid | — | boolean | undefined Whether the file input is invalid |
transformFiles | — | ((files: File[]) => Promise<File[]>) | undefined Function to transform the accepted files to apply transformations |
locale | "en-US" | string | undefined The current locale. Based on the BCP 47 definition. |
dir | "ltr" | "ltr" | "rtl" | undefined The document's text/writing direction. |
getRootNode | — | (() => ShadowRoot | Node | Document) | undefined A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Provider
| Prop | Default | Type |
|---|---|---|
value | — | () => FileUploadApi<PropTypes> |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Context
| Prop | Default | Type |
|---|---|---|
children | — | Snippet<[() => FileUploadApi<PropTypes>]> |
Label
label-text| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"label">]> | undefined Render the element yourself |
Dropzone
card px-4 py-10 border border-dashed border-surface-200-800 flex flex-col justify-center items-center gap-2 data-dragging:preset-tonal| Prop | Default | Type |
|---|---|---|
disableClick | — | boolean | undefined Whether to disable the click event on the dropzone |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Trigger
btn preset-filled| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"button">]> | undefined Render the element yourself |
HiddenInput
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"input">]> | undefined Render the element yourself |
ItemGroup
flex flex-col gap-2| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"ul">]> | undefined Render the element yourself |
Item
grid grid-cols-[auto_1fr_auto] gap-4 items-center preset-tonal px-4 py-2 rounded| Prop | Default | Type |
|---|---|---|
file | — | File |
type | — | ItemType | undefined |
element | — | Snippet<[HTMLAttributes<"li">]> | undefined Render the element yourself |
ItemName
text-sm| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
ItemSizeText
text-xs opacity-60| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
ItemDeleteTrigger
btn-icon| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"button">]> | undefined Render the element yourself |