Componentpickers0.97 KB gzipZero dependencies
Avatar Upload
Avatar upload circle with hover camera overlay and preview.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add avatar-uploadOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { AvatarUpload } from "@/components/ui/avatar-upload"; <AvatarUpload />Source code
avatar-upload.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| initials | string | Configures initials. (Default: "BB") |
| src | string | Configures src. |
| onChange | (file: File) => void | Callback invoked on change. |