Avatar upload
Profile photo card with a drag-and-drop zone where the chosen image fills a progress ring, gets zoomed and repositioned in a circular crop, then flies into the header avatar on save.
Installation
Installation is available on the Startup and Business plans. Your personal install command appears here once you have access.
Usage
Import it, pass your props, and make it part of your product.
import { AvatarUpload } from '@/components/component-kit/items/block-avatar-upload';
export function Example() { return <AvatarUpload onChange={(file, dataUrl) => console.log(file, dataUrl)} />;}Props
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | "Alex Rivera" | Display name in the header; also drives the initials fallback. |
email | string | "alex@nextbase.dev" | Email shown under the name. |
initialSrc | string | null | null | Starting avatar image URL. Omit to start with initials. |
maxSizeMb | number | 5 | Maximum accepted file size; larger files are rejected with a hint. |
onChange | (file: File | null, dataUrl: string | null) => void | undefined | Called with the source file and cropped PNG data URL on save, and with nulls on remove. |
compact | boolean | false | Dropzone only, at a smaller scale; used by the index card. |
autoPlay | boolean | false | With compact, replays the progress ring fill on a sample photo every 2.6s. |