Upload

File upload component with drag-and-drop and file list management.

When to Use

  • For file attachments in forms
  • For image or document uploads
  • When drag-and-drop upload is needed

Import

import { Upload } from "orizon";

Examples

Basic

<Upload action="/api/upload" onChange={({ fileList }) => setFiles(fileList)}>
  <Button icon={<UploadCloud size={16} />}>Click to Upload</Button>
</Upload>

Drag and Drop

Click or drag files to this area to upload

<Upload.Dragger action="/api/upload">
  <p><UploadCloud size={32} /></p>
  <p>Click or drag files to this area to upload</p>
</Upload.Dragger>

Picture Card

<Upload listType="picture-card" action="/api/upload">
  + Upload
</Upload>

API

UploadProps

  • actionstring | (file) => Promise<string> — Upload URL
  • fileListUploadFile[] — Managed file list (controlled)
  • onChange({ file, fileList }) => void — File status change handler
  • multipleboolean — Allow multiple files (default: false)
  • maxCountnumber — Maximum number of files
  • beforeUpload(file) => boolean | Promise — Pre-upload validation
  • customRequest(options) => void — Custom upload implementation
  • listType"text" | "picture" | "picture-card" — File list display style
  • acceptstring — Accepted file types
  • disabledboolean — Disable upload
  • showUploadListboolean — Show file list (default: true)
  • directoryboolean — Upload entire directory

Upload.Dragger Props

Same as UploadProps, rendered as a drag-and-drop area.