Skip to content
caliper ui pro docs

Avatar upload

Change a profile photo in place. Click the avatar or drop an image on it and the photo opens inside the circle to position and zoom; saving crops it, uploads it through a ring that fills around the avatar, and settles with a tick.

Pro

Click or drop a photo

When to use

  • Profile, account and team member settings.
  • Workspace and organisation logos (any square image).

When not to use

  • Galleries or several files at once; use `FileDropzone`.
  • Free-form crops; use `ImageCrop`.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/avatar-upload

Adds its 4 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

API reference

AvatarUpload

4 props

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
name *string—The person's name, for the photo's fallback and labels.
srcstring—The current photo.
onUpload *(photo: Blob, progress: (fraction: number) => void) => Promise<string | void>—Uploads the cropped square photo, calling `progress` with 0 to 1 as it goes. Resolve with the new photo's URL, or throw to show an error.
sizenumber96Pixels across.

Keyboard

Enter
Activates the focused control.
Escape
Closes or cancels, then returns focus to where it came from.

Accessibility

It exposes img semantics, with aria-label, aria-hidden and aria-live kept in step with state. Changes that matter are announced through a live region.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/avatar-upload.md

The index of every part is at /llms.txt.

More in Media