Skip to content
synccn

Avatar Upload

New

Click or drop an image to set a profile photo.

PNG, JPG or GIF, up to 4 MB. Drop an image on the circle too.

Installation

$ pnpm dlx shadcn@latest add @synccn/avatar-upload

First time in this project? Connect synccn with one command.

Usage

import { AvatarUpload } from "@/components/ui/avatar-upload";<AvatarUpload name="Michael" onChange={setFile} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

AvatarUpload

Round avatar picker: click or drop an image to preview it; remove to go back to initials.

  • name
    string

    Default ""

    Used for initials before a photo is chosen.

  • size
    number

    Default 96

    Avatar diameter in pixels.

  • maxSize
    number

    Default 4 * 1048576

    Largest file allowed, in bytes.

  • onChange
    (file: File | null) => void

    Called with the chosen file, or null when removed.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Accessibility

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA attributes: aria-label
  • Shows a visible focus ring for keyboard users
  • Includes text only screen readers hear