Forms

Upload

Premium file upload area with drag and drop support and animated feedback.

Integrated Upload

A premium file upload area with drag and drop support and animated feedback. Automatically detects and shows file types with minimal iconography.

Click or drag file to uploadDrag and drop your assets here
'use client'

import React from 'react'
import { Upload } from 'biibaos'

export default function BasicUpload() {
  return (
    <Upload 
      multiple 
      label="Upload assets" 
      description="Drag and drop or click to browse" 
    />
  )
}

Real-world: Asset Manager

A comprehensive example demonstrating multiple file selection, size validation (5MB limit), type filtering (Images/PDFs), and live upload progress synchronization.

Cloud Asset ManagerSupports JPG, PNG, and PDF (Max 5MB)
'use client'

import React, { useState } from 'react'
import { Upload, Stack, Badge } from 'biibaos'

export default function AssetManager() {
  const [loading, setLoading] = useState(false)
  const [progress, setProgress] = useState(0)
  const [fileCount, setFileCount] = useState(0)

  const simulateUpload = (files: File[]) => {
    setFileCount(files.length)
    setLoading(true)
    setProgress(0)

    const interval = setInterval(() => {
      setProgress(prev => {
        if (prev >= 100) {
          clearInterval(interval)
          setTimeout(() => setLoading(false), 500)
          return 100
        }
        return prev + 2
      })
    }, 50)
  }

  return (
    <Stack direction="column" gap={20} style={{ width: '100%' }}>
      <Upload
        multiple
        accept="image/*,.pdf"
        maxSize={5 * 1024 * 1024} // 5MB
        isLoading={loading}
        loadingProgress={progress}
        onUpload={simulateUpload}
        label={loading ? `Uploading ${fileCount} file(s)...` : 'Cloud Asset Manager'}
        description="Supports JPG, PNG, and PDF (Max 5MB)"
      />

      {loading && (
        <Badge variant="primary" pulse pill>
          Syncing to Cloud: {progress}%
        </Badge>
      )}
    </Stack>
  )
}

Properties

PropTypeDefaultDescription
acceptstringComma-separated list of allowed file extensions (e.g. image/*, .pdf)
multiplebooleanfalseIf true, permits multiple selections or files
maxSizenumber // in bytesMaximum allowed individual file size in bytes
onUpload(files: File[]) => voidCallback triggered when files are selected or dropped
labelstring'Click or drag file to upload'Primary text label description
descriptionstring'Support for single or bulk upload.'Supporting description or helper guidance text
iconReact.ReactNodeCustom icon prefix element
isLoadingbooleanfalseEnables full loading layout with progress bar
loadingProgressnumber0Percentage progress value (0 to 100) shown on the bar