shadcn.io is not affiliated with official shadcn/ui
Avatar Upload Onboarding Block for React
A picture step split in two: the member's initials turn into a round cropper for a file chosen on the device, and the crop shows live at 96, 40 and 24 pixels.
Installation
Overview
Let a new member put a face to their name without leaving the sign-up flow, with this picture step for React with Base UI. It is a whole screen of Moothall, a community forum: the page's rails and one band, split in two. The first half has the step header ("Step 2 of 5" and a hairline), the heading and a square frame holding the member's initials. Choose a picture opens the file picker (File Upload: one PNG, JPEG or WebP up to 4 MB), and the frame becomes the Image Cropper with a round selection: drag it, or focus it and press the arrow keys to move it and plus or minus to zoom, or use the Zoom Slider. The second half shows the crop live at 96, 40 and 24 pixels, as a profile, a post and a mention show it, and how much of the picture it keeps. Remove goes back to the initials. Continue is the one Shine Button, with a quiet Skip for now. No photo is shipped: the frame holds initials until the visitor chooses a file.
FAQ
Is the picture uploaded?
No. The file is read in the tab: it is shown through an object URL, its pixel size is read once so the cropper can match its shape, and the URL is released when the picture is removed, replaced or the page goes. The page says so under the button. In your app, crop with the cropper's own export and send the result where submit says so.
Can the crop be made without a mouse?
Yes. Tab to the circle (it is named "Crop selection area") and press the arrow keys to move it; plus and minus zoom, and the Zoom slider does the same. The three previews follow every move, because they read where the circle sits on the picture rather than keeping a copy.
What if the file is not a picture, or too big?
It is refused in words under the buttons: "notes.txt is not a PNG, JPEG or WebP." or "photo.png is 6.2 MB. The limit is 4 MB." A file the browser cannot decode is refused too. The line is always reserved, so nothing moves, and the status line says which file was not used.
How are the three sizes drawn?
Each preview is a round box with the picture inside it, sized and offset by three CSS properties worked out from the circle's place on the picture. Because every share is measured against the picture's width, a picture that is not square keeps its shape. Before a picture is chosen they show the initials.
Related
- Pro
Avatar Upload Account
ProfileThe current picture of an account with a file chooser that checks the type and size in words, the last five pictures kept as tiles with Restore and an in-place Delete, and a switch that keeps the history.
- Pro
A profile page with its cover-crop dialog shown open: a drawn landscape in an image cropper with shape, zoom, turn and reset controls, and the same crop shown live as an avatar, a card thumbnail and a banner strip.
- Pro
Circular Crop Gallery
Compare, crop and zoomA circle cropper with four drawn pictures to pick from and the crop live at three profile-picture sizes, with zoom buttons and a reset.
- Pro
Profile Setup Onboarding
Profile and accountA profile step for a creator site: name, what you do, pronouns and a bio with a count in a form, and beside it the card others will see, redrawn on every keystroke, with the profile address worked out from the name.
- Pro
Demo Booking Onboarding
Profile and accountA walkthrough booking dialog drawn open over a CRM pipeline: five working days, five times a day with some taken, a name and an email, and a booking that shows behind it.
- Pro
Referral Code Onboarding
Profile and accountA setup panel that loads with a friend's code applied, shows what it takes off the first invoice, and lets a different code be tried, with copyable sample codes.