Upload - Keep React

Upload Component is a user interface element that enables users to upload files or media from their local device to a web application or platform. It provides a means to select files, preview them if applicable, and initiate the upload process. The component is essential for allowing users to share content, images, documents, and other files with the application or website.

Table of Contents#

Default Upload#

The Default Upload component enables users to choose and upload a file.The onFileChange callback is used to handle the file selection and update the selected file's name.

Upload Pending#

The progressType prop is set to "pending" to indicate that the progress is pending.

Uploading...

45%

1 minutes left

Upload Failed#

The progressType prop is set to "error" to indicate that the progress is failed.

Something error

45%

2 days left

Upload Success#

The progressType prop is set to "success" to indicate that the progress is success.

File Name.pdf

Size: 515 Kb

Horizontal Upload#

The horizontal prop is set to true, allowing for a horizontal layout.

Horizontal Upload Pending#

The progressType="pending" and horizontal={true} props indicate that the horizontal upload progress is pending.

Uploading...

45%

1 minutes left

Horizontal Upload Failed#

The progressType="error" and horizontal={true} props indicate that the horizontal upload progress is failed.

Something error

45%

21 minutes left

Horizontal Upload Success#

The progressType="success" and horizontal={true} props indicate that the horizontal upload progress is success.

File Name.pdf

Size: 515 Kb

Horizontal Disabled Upload#

The horizontal={true} and disabled={true} props indicate that the horizontal upload disabled.

Upload Disabled#

The disabled={true} prop indicate that the upload component is disabled.

API Reference#

Explore the available props for the upload component

PropertyDescriptionTypeDefault
fileThe selected file's name or path for display.stringNone
horizontalArranges the component horizontally if set to true.booleanfalse
disabledDisables interactions with the upload component.booleanfalse
showProgressBarIndicates whether to display a progress bar during file upload.booleanfalse
progressTypeSets the visual style of the progress bar based on the upload status.
success
error
pending
pending
progressThe progress percentage of the file upload.number0
uploadTimeTimestamp indicating the time of the upload.string0
onFileChangeCallback function when the selected file changes.Function(e:ChangeEvent)=>void