Componentpickers0.97 KB gzipZero dependencies

Avatar Upload

Avatar upload circle with hover camera overlay and preview.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add avatar-upload

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { AvatarUpload } from "@/components/ui/avatar-upload"; <AvatarUpload />

Source code

avatar-upload.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxavatar-upload.tsx59 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface AvatarUploadProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {  initials?: string;  src?: string;  onChange?: (file: File) => void;} /** Circular avatar uploader: hover camera overlay + loading spinner. */export function AvatarUpload({ initials = "BB", src, onChange, className, ...props }: AvatarUploadProps) {  const [preview, setPreview] = React.useState<string | null>(src ?? null);  const [uploading, setUploading] = React.useState(false);  const inputRef = React.useRef<HTMLInputElement>(null);   const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { AvatarUpload } from "@/components/ui/avatar-upload"; <AvatarUpload />
PropTypeDescription
initialsstringConfigures initials. (Default: "BB")
srcstringConfigures src.
onChange(file: File) => voidCallback invoked on change.