File Upload
<FileUpload>TailwindCSS ModulesCollect files with a dropzone, file previews, progress indicators, and retry actions. Configure accepted file types, size limits, and selection counts while keeping upload state under your application's control.
npx coloxo add file-upload --style coloxo-cssimport { FileUpload } from '@coloxo/ui';Design Tokens:
1. Variant Matrix
Both progress variants share the same dropzone and validation behavior. Choose files or drop them into an enabled area to try the local upload simulation.
| Variant | Default | Invalid | Disabled |
|---|---|---|---|
| bar | or drag and drop Any file type / max. 5 MB | or drag and drop Attach a supporting document A file is required. | or drag and drop Uploads are unavailable |
| fill | or drag and drop Any file type / max. 5 MB | or drag and drop Attach a supporting document A file is required. | or drag and drop Uploads are unavailable |
2. File states & progress
Use progress and status to represent active uploads, completed files, and failures. The application supplies upload progress and handles retry requests.
Progress variants
progressVariant="bar"DEFAULT- 40%
- 100%
progressVariant="fill"File type icons
.docx
.png
.mp4
.zip
.tsx
3. File types & limits
Set clear expectations before selection. Unsupported types are rejected; oversized files appear as failed entries. Remove an oversized file and choose a smaller one.
Selection constraints
Images onlyImages / max. 2 MB
Image selections show a local thumbnail.
Single documentOne PDF document
Remove the existing file to replace it.
File countAny file type / up to 3 files
Additional files are ignored at the limit.
4. Interactive Props Configurator
Any file type / max. 5 MB per file / up to 5 files
0 files selected. Uploads are simulated locally.
const [files, setFiles] = useState<UploadFile[]>([]);<FileUpload label="Project files" hint="Any file type / max. 5 MB per file / up to 5 files" progressVariant="bar" maxSize={5 * 1024 * 1024} maxFiles={5} files={files} onFilesChange={setFiles} onRetry={handleRetry}/>5. Dark theme
Dropzones, file icons, and progress indicators use the shared theme tokens for dark forms and dashboards.
barAny file type / max. 5 MB
- 65%
fillAny file type / max. 5 MB
6. Enterprise layout compositions
Pair file selection with clear requirements in project and support workflows.
Project handover
Collect the documents your team needs to get started.
PDF, DOC or DOCX / max. 10 MB / up to 5 files
Support request
Attach screenshots that help explain the issue.
Images / max. 5 MB / up to 3 files
Accessibility
Tab to Click to upload and press Enter or Space to open the native file chooser. Drag and drop is an additional way to select files.
Keep accepted formats and size limits visible in the hint. File rows show names and progress values; failed uploads include a text status.
Delete buttons include the file name in their accessible label. Retry actions are keyboard accessible and call onRetry for the selected file.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| progressVariant | "bar" | "fill" | bar | List item progress style. |
| label / description / error | ReactNode | — | Field label, supporting text, and validation message. |
| required / optional | boolean | — | Display the required or optional field indicator. |
| files | UploadFile[] | — | Controlled file list with id, native file or name/size, thumbnailUrl, progress, status, and failure details. |
| onFilesChange | (files: UploadFile[]) => void | — | Receives the updated list after selection or deletion. New accepted files start queued; the application performs uploads and supplies progress. |
| hint | ReactNode | — | Constraints line under the CTA. |
| accept | string | — | Accept attribute (extensions or MIME). |
| maxSize | number | — | Max bytes per file. |
| maxFiles | number | — | Maximum number of entries. Additional files are ignored when the limit is reached. |
| multiple | boolean | true | Allow more than one file. |
| disabled | boolean | — | Disable dropzone. |
| onRetry | (file: UploadFile) => void | — | Retry failed upload. |