FileUpload
An unstyled file upload component with drag-and-drop, validation, and progress tracking.
Build fully custom file uploaders with complete control over layout, file lists, and drag-and-drop zones.
Pre-styled Versions
Features#
- Compound component API with sub-components:
Root,Content,List,ItemGroup,Item,ItemPreview,ItemInfo,ItemName,ItemSize,Remove - Built-in file type and size validation with configurable error messages
- Drag-and-drop file selection with visual highlight feedback
- XMLHttpRequest-based upload with progress tracking
- Custom upload handler support for client-side file processing
- Separate tracking of pending and uploaded files
- Composable file item rendering with
Itemcontext providing file data to nested sub-components
Usage#
import { FileUpload } from 'primereact/fileupload';<FileUpload.Root>
<FileUpload.Content>
<FileUpload.ItemGroup>
<FileUpload.Item>
<FileUpload.ItemPreview />
<FileUpload.ItemInfo>
<FileUpload.ItemName />
<FileUpload.ItemSize />
</FileUpload.ItemInfo>
<FileUpload.Remove></FileUpload.Remove>
</FileUpload.Item>
</FileUpload.ItemGroup>
</FileUpload.Content>
</FileUpload.Root>Behavior#
Polymorphic Rendering#
Use as on any sub-component to change the rendered HTML element.
<FileUpload.Root as="section">
<FileUpload.Content as="main"></FileUpload.Content>
</FileUpload.Root>Default elements: Root=div, Content=div, List=div, ItemGroup=div, Item=div, ItemPreview=img, ItemInfo=div, ItemName=div, ItemSize=div, Remove=button.
Render Function Children#
Root accepts a render function as children, providing access to the component instance with state, methods, and computed properties.
<FileUpload.Root>
{(instance) => (
<>
<button onClick={instance.choose}>Choose Files</button>
<button onClick={instance.upload}>Upload</button>
<FileUpload.Content>
<FileUpload.ItemGroup>
{instance.state.files.map((file, index) => (
<FileUpload.Item key={file.name + file.size} file={file} index={index}>
<FileUpload.ItemPreview />
<FileUpload.ItemInfo>
<FileUpload.ItemName />
<FileUpload.ItemSize />
</FileUpload.ItemInfo>
<FileUpload.Remove onClick={() => instance.remove(index)}>Remove</FileUpload.Remove>
</FileUpload.Item>
))}
</FileUpload.ItemGroup>
</FileUpload.Content>
</>
)}
</FileUpload.Root>Pass Through#
Some parts may not be visible in the preview depending on the component's current state.
/* Select a part to see its CSS selector for custom styling */API#
FileUploadRoot#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadRootInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadRootInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadRootInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadRootPassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadRootInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
name | string | — |
| Name of the request parameter to identify the files at backend. | ||
url | string | — |
| Remote url to upload the files. | ||
multiple | boolean | false |
| Used to select multiple files at once from file dialog. | ||
accept | string | — |
| Pattern to restrict the allowed file types such as "image/*". | ||
disabled | boolean | false |
| When present, it specifies that the element should be disabled. | ||
auto | boolean | false |
| When enabled, upload begins automatically after selection is completed. | ||
maxFileSize | number | — |
| Maximum file size allowed in bytes. | ||
fileLimit | number | — |
| Maximum number of files that can be uploaded. | ||
withCredentials | boolean | false |
| Cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates. | ||
customUpload | boolean | false |
| Whether to use the default upload or a manual implementation defined in uploadHandler callback. | ||
invalidFileLimitMessage | string | 'Maximum number of files exceeded, limit is {0} at most.' |
| Message to display when number of files to be uploaded exceeds the limit. | ||
invalidFileSizeMessage | string | '{0}: Invalid file size, file size should be smaller than {1}.' |
| Message to display when file size exceeds the limit. | ||
invalidFileTypeMessage | string | '{0}: Invalid file type, allowed file types: {1}.' |
| Message to display when file type is not allowed. | ||
uploadHandler | (event: FileUploadHandlerEvent) => void | — |
| Callback to invoke to implement a custom upload. | ||
onSelect | (event: FileUploadSelectEvent) => void | — |
| Callback to invoke when files are selected. | ||
onBeforeUpload | (event: FileUploadBeforeUploadEvent) => void | — |
| Callback to invoke before file upload begins to customize the request such as post parameters before the files. | ||
onUpload | (event: FileUploadUploadEvent) => void | — |
| Callback to invoke when file upload is complete. | ||
onError | (event: FileUploadErrorEvent) => void | — |
| Callback to invoke if file upload fails. | ||
onProgress | (event: FileUploadProgressEvent) => void | — |
| Callback to invoke on upload progress. | ||
onBeforeSend | (event: FileUploadBeforeSendEvent) => void | — |
| Callback to invoke before send for customization such as adding headers. | ||
onClear | () => void | — |
| Callback to invoke when files in queue are removed without uploading. | ||
onRemove | (event: FileUploadRemoveEvent) => void | — |
| Callback to invoke when a file is removed. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
Defines passthrough(pt) options of FileUpload component.
| label | type | description |
|---|---|---|
| root | FileUploadRootPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the root's DOM element. |
| content | FileUploadRootPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the content's DOM element. |
| fileList | FileUploadRootPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the file list's DOM element. |
| file | FileUploadRootPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the file's DOM element. |
| fileThumbnail | FileUploadRootPassThroughType<HTMLAttributes<HTMLImageElement>> | Used to pass attributes to the file thumbnail's DOM element. |
| fileInfo | FileUploadRootPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the file info's DOM element. |
| fileName | FileUploadRootPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the fileName's DOM element. |
| fileSize | FileUploadRootPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the fileSize's DOM element. |
| fileActions | FileUploadRootPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the file actions' DOM element. |
| fileRemove | FileUploadRootPassThroughType<HTMLAttributes<HTMLButtonElement>> | Used to pass attributes to the file remove button's DOM element. |
FileUploadContent#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadContentInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadContentInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadContentInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadContentPassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadContentInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
| Attribute | Value |
|---|---|
data-highlight | "true" when files are dragged over the zone |
Defines passthrough(pt) options of FileUploadContent component.
| label | type | description |
|---|---|---|
| root | FileUploadContentPassThroughType<HTMLAttributes<HTMLButtonElement>> | Used to pass attributes to the root's DOM element. |
FileUploadList#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadListInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadListInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadListInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadListPassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadListInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
Defines passthrough(pt) options of FileUploadList component.
| label | type | description |
|---|---|---|
| root | FileUploadListPassThroughType<HTMLAttributes<HTMLButtonElement>> | Used to pass attributes to the root's DOM element. |
| fileList | FileUploadListPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the file list's DOM element. |
| file | FileUploadListPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the file's DOM element. |
| fileThumbnail | FileUploadListPassThroughType<HTMLAttributes<HTMLImageElement>> | Used to pass attributes to the file thumbnail's DOM element. |
| fileInfo | FileUploadListPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the file info's DOM element. |
| fileName | FileUploadListPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the fileName's DOM element. |
| fileSize | FileUploadListPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the fileSize's DOM element. |
| fileActions | FileUploadListPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the file actions' DOM element. |
FileUploadItemGroup#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadItemGroupInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadItemGroupInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadItemGroupInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadItemGroupPassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadItemGroupInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
Defines passthrough(pt) options of FileUploadItemGroup component.
| label | type | description |
|---|---|---|
| root | FileUploadItemGroupPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the root's DOM element. |
FileUploadItem#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadItemInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadItemInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadItemInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadItemPassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadItemInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
file | File | — |
| The file object to display. | ||
index | number | — |
| The index of the file in the list. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
Defines passthrough(pt) options of FileUploadItem component.
| label | type | description |
|---|---|---|
| root | FileUploadItemPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the root's DOM element. |
FileUploadItemPreview#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadItemPreviewInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadItemPreviewInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadItemPreviewInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadItemPreviewPassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadItemPreviewInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
Defines passthrough(pt) options of FileUploadItemPreview component.
| label | type | description |
|---|---|---|
| root | FileUploadItemPreviewPassThroughType<HTMLAttributes<HTMLImageElement>> | Used to pass attributes to the root's DOM element. |
FileUploadItemInfo#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadItemInfoInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadItemInfoInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadItemInfoInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadItemInfoPassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadItemInfoInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
Defines passthrough(pt) options of FileUploadItemInfo component.
| label | type | description |
|---|---|---|
| root | FileUploadItemInfoPassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the root's DOM element. |
FileUploadItemName#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadItemNameInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadItemNameInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadItemNameInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadItemNamePassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadItemNameInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
Defines passthrough(pt) options of FileUploadItemName component.
| label | type | description |
|---|---|---|
| root | FileUploadItemNamePassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the root's DOM element. |
FileUploadItemSize#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadItemSizeInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadItemSizeInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadItemSizeInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadItemSizePassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadItemSizeInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
Defines passthrough(pt) options of FileUploadItemSize component.
| label | type | description |
|---|---|---|
| root | FileUploadItemSizePassThroughType<HTMLAttributes<HTMLDivElement>> | Used to pass attributes to the root's DOM element. |
FileUploadRemove#
| Name | Type | Default |
|---|---|---|
ref | Ref<unknown> | — |
| The reference to the component instance. | ||
pIf | boolean | true |
| Whether the component should be rendered. | ||
style | CSSProperties | ((instance?: FileUploadRemoveInstance) => CSSProperties) | — |
| The style to apply to the component. | ||
className | string | ((instance?: FileUploadRemoveInstance) => string) | — |
| The class name to apply to the component. | ||
as | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode> | — |
| The component type to render. | ||
asChild | boolean | false |
| Whether the component should be rendered as a child component. | ||
instance | FileUploadRemoveInstance | — |
| The instance to pass to the component. | ||
pt | SafeRecord<FileUploadRemovePassThrough> | — |
| The pass-through props to pass to the component. | ||
ptOptions | PassThroughOptions | — |
| The pass-through options to pass to the component. | ||
unstyled | boolean | — |
| Whether the component should be rendered without classes. | ||
dt | unknown | — |
| The design token to use for the component. | ||
styles | StylesOptions<ComponentInstance> | — |
| The styles to use for the component. | ||
render | (instance: FileUploadRemoveInstance) => ReactNode | — |
| The render function to render the component with instance access. | ||
children | any | — |
| The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates. | ||
[key: string] | any | — |
pt-{optionName}-* | - | — |
| Pass through attributes for customizing component. For more info, see Pass Through tab. | ||
Defines passthrough(pt) options of FileUploadRemove component.
| label | type | description |
|---|---|---|
| root | FileUploadRemovePassThroughType<HTMLAttributes<HTMLButtonElement>> | Used to pass attributes to the root's DOM element. |
Accessibility#
Screen Reader#
FileUpload uses a hidden native input[type="file"] element for file selection. The choose button triggers this input programmatically. File thumbnails use role="presentation" to indicate decorative images. Error messages are rendered as visible text for screen reader announcement.
Keyboard Support#
| Key | Function |
|---|---|
tab | Moves focus between the choose, upload, cancel buttons and file remove buttons. |
enter / space | Activates the focused button. Opens the file dialog when the choose button is focused. |