GitHub
Core
Glass
Brutal
Humanist

Image Upload

ImageUpload provides a dedicated interface for uploading and managing brand logos and user avatars.

Image Upload Playground

Image Upload Playground
Preview
Code
Upload Company Logo
PNG or JPG up to 5 MB
Controls
Type:
Logo
Avatar

Installation

You can add the image upload component to your project manually:

1

Install the following dependencies:

npm install class-variance-authority clsx tailwind-merge @phosphor-icons/react @react-aria/focus @react-aria/interactions
2

Copy and paste the following code into your project.

Loading source code...
3

Update the import paths to match your project setup.

Update the import aliases (e.g. @/components, @/utils) in the copied files to match your project's path configuration.

Basic Usage

import { ImageUpload } from '@versaui/ui/components/FileUpload';
<ImageUpload
  imageType="avatar"
  onImageSelect={(file) => uploadFile(file)}
  onRemove={() => console.log('Removed')}
/>

Accessibility

  • Upload button is keyboard accessible
  • Image preview has descriptive alt text
  • Remove action has accessible label

ImageUpload Props

PropTypeDefaultDescription
imageType'logo' | 'avatar''logo'Upload type (affects layout).
titlestringTitle text above the upload area.
descriptionstringDescription text below title.
acceptstring'image/png, image/jpeg, image/jpg'Accepted MIME types.
imageUrlstringURL for initial/existing image.
onImageSelect(file: File) => voidCallback when image is selected.
onRemove() => voidCallback when image is removed.
onChange() => voidCallback when change button is clicked.
widthnumber | string600Container width.
classNamestring''Additional CSS classes.

On this page