HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • Artwork
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Brand SVG
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Meter
  • Multi Select
  • Native Select
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stat Tabs
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Brand SVG
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sortable
  • Spinner
  • Stat
  • Stat Tabs
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Brand SVG
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Cart Button
  • Cart Line Item
  • Cart Summary
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • Fill Blank
  • File Icon
  • File Upload
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Person Avatar
  • Phone Input
  • Popover
  • Price
  • Product Card
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stat Tabs
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
  • Accordion
  • Alert Dialog
  • Alert
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar Upload
  • Avatar
  • Badge
  • Banner
  • Bot Avatar
  • Brand SVG
  • Breadcrumb
  • Button Group
  • Button
  • Calendar
  • Card
  • Carousel
  • Cart Button
  • Cart Line Item
  • Cart Summary
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker Primitive
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Icon
  • File Upload
  • Fill Blank
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input Group
  • Input OTP
  • Input
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Person Avatar
  • Phone Input
  • Popover
  • Price
  • Product Card
  • Progress Circle
  • Progress
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat Tabs
  • Stat
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toggle Group
  • Toggle
  • Tooltip
  • Tree
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
  • Message Toolbar
Blocks
  • Airtable
  • Airtable Kanban
  • CRM
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • App Shell
  • Record Files
  • Settings Shell
  • Help Panel
  • Note Editor
  • Email Drafts
  • Task List
  • Notifications Panel
  • Dual Pane Sidebar
  • Team Members Panel
  • Mix Pack Builder
  • Record Picker and Date Quick-pick
  • Record List
  • Record Page
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • AI Assistant
  • Voice Message
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Standings
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Templates
  • Sign In Page
  • Upload Page
  • Showcase Onboarding
  • Agreement Sign
  • Email
  • Email Composer
  • Share Dialog
  • Integrations
  • Transactions
  • Analytics
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Avatar Upload

PreviousNext

Pick or drop a photo, crop it to a circle, and show it in an Avatar. Hands back a data URL and a Blob.

UI SDKBase UIReact AriaRadix UI
Profile photo
Shown on invoices and in the client portal.

JPG, PNG or WebP, up to 10 MB. You can crop it next.

JPG, PNG or WebP, up to 10 MB. You can crop it next.

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/another/ui-sdk-nova/avatar-upload.json

Usage#

import { AvatarUpload } from "@/components/ui/avatar-upload"
<AvatarUpload
  defaultValue="/avatars/02.png"
  fallback="JV"
  onUpload={async ({ blob }) => {
    await fetch("/api/avatar", { method: "PUT", body: blob })
  }}
/>

Cropping#

Picking or dropping an image opens the cropper. It is a Dialog on larger screens and a Drawer on phones.

  • Drag the photo to move it. Arrow keys nudge it, and Shift makes the steps bigger.
  • Zoom with the Slider, the buttons beside it, the mouse wheel, a pinch, or the plus and minus keys.
  • The photo always covers the circle, so there are never empty edges.

Saving draws the square behind the circle to a canvas. The Avatar rounds it, so the saved image stays square and works anywhere.

Props#

  • value, defaultValue, onChange. The image as a URL or data URL. onChange gets the new data URL, or null after Remove, plus the Blob and the source file.
  • onUpload. Runs with the cropped Blob before the photo is set. If it throws, the message shows under the buttons and the old photo stays.
  • outputSize, outputType, outputQuality. The saved image size in pixels (512 by default), PNG, JPEG or WebP, and the quality for the last two.
  • accept, maxSize. Which files can be picked, and the largest source file in bytes (10 MB by default).
  • fallback, label, description, disabled. What shows with no photo, the button text, and the hint under it.

Remove uses the destructive button. The cropper plays the open sound, saving plays success, and a bad file plays error.

Audio PlayerAvatar

On This Page

InstallationUsageCroppingProps