Black Friday: 30% off Pro

Get 30% off

Updated

Avatar Upload

New

Preview

Customize

Size104px
circle
Blur10px
Max size5MB
Upload time2.4s

Installation

npx shadcn@latest add https://uibrik.com/r/avatar-upload.json
Adds the files to components/uibrik/avatar-upload and installs @tabler/icons-react and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/avatar-upload.

Usage

import { AvatarUpload } from "@/components/uibrik/avatar-upload/avatar-upload";​const accept = "image/png,image/jpeg,image/webp,image/gif,image/avif";​<AvatarUpload  size={104}  shape="circle"  blur={10}  maxSizeMb={5}  removable  showStatus  defaultValue={null}  name="Ada Park"  accept={accept}  disabled={false}  onUpload={(file, { onProgress, signal }) => {}}  // value="…"  // onChange={(src, file) => {}}/>

Where to use Avatar Upload

  • Profile settings

    The new photo appears the moment it's picked, so the person sees the result while it saves.

    Pairs with Settings Page

  • Onboarding

    One tap, drag and drop or paste covers every way people add a photo.

    Pairs with Multi-step Form

  • Team and workspace logos

    The rounded shape fits logos, and failed uploads keep the image with a Retry.

    Pairs with Team Roster

Props

AvatarUpload
size
Type number
104
Avatar diameter.
shape
Type "circle" | "rounded"
"circle"
Circle for people, rounded square for logos.
blur
Type number
10
Blur on the photo at 0%. It clears as the upload runs.
maxSizeMb
Type number
5
Largest file accepted.
removable
Type boolean
true
Show a Remove action under a set photo.
showStatus
Type boolean
true
Hints, progress and errors under the avatar.
value / onChange
Type string | null / (src, file?) => void
–
Controlled image URL. onChange gets the stored URL (or the local preview URL with no onUpload) and the picked file, or null on remove.
defaultValue
Type string | null
–
Image URL on mount when uncontrolled.
onUpload
Type (file, { onProgress, signal }) => Promise<string | void>
–
Uploads the file. Call onProgress with 0 to 1, resolve with the stored image's URL, throw to fail. The signal aborts when the person cancels. Leave out to accept files locally.
name
Type string
–
Initials shown with no photo, and the accessible name.
accept
Type string
"image/png,image/jpeg,image/webp,image/gif,image/avif"
Which files the picker offers.
disabled
Type boolean
false
Ignore presses and drops.
className
Type string
–
Classes for the wrapper.