Skip to content
GitHub ↗

Forms / React + CSS

Upload zone

A responsive drop area with a floating file stack and clear validation.

Live preview
Drop your next idea here.

PNG, JPEG, WebP or SVG · up to 5 MB

Make it yours

Use as a file selection step. This component only selects and validates a file; connect upload, progress, server validation, and failure handling in your application. Do not trust client-side MIME checks on the server.

  1. Use a React project with CSS Modules support, such as Next.js or Vite.
  2. Save the JSX as UploadZone.jsx and the CSS as UploadZone.module.css in the same folder.
  3. Import UploadZone and connect its props to your application. Controlled components need parent state and change handlers.

No third-party component or animation package is required. Use the theme controls to adjust accent, corners, spacing, and type. Copy the Theme CSS into your stylesheet and wrap your components in <div className="tdp-components">. The theme applies to every component inside that wrapper. TDP defaults work without a theme file.

Props

PropTypeUse
onFilefunctionReceives the validated File; no network upload is performed.
maxBytesnumberMaximum file size in bytes; defaults to 5 MiB.

Accessibility & behavior

A keyboard-accessible button opens the file picker; drag-and-drop is optional. File selection and validation are announced. The native file input is triggered by the visible button.

Visible focus styles and reduced-motion support are included. Check labels, contrast, keyboard behavior, and screen-reader output again after adapting the component to your product.

Keep building