AvatarUpload
A person's picture, in a circle: their initials until there is one.
import { AvatarUpload } from '@sypnia/ui/react'
On this page
A profile photo
AR
Code
import { useState } from 'react';
import { AvatarUpload } from '@sypnia/ui/react';
// The initials until there is a photo.
export default function Photo() {
const [file, setFile] = useState<File | null>(null);
return <AvatarUpload name="Ana Ruiz" file={file} onChange={setFile} />;
} When to use it
Use it when
- Profiles and members.
Do not use it when
- Logos: use ImageUpload, which keeps the shape.
For everyone
- The avatar is named with the person's name.
Props
| AvatarUpload | Type | Default |
|---|---|---|
namerequired | string | |
onChangerequired | (f: File | null) => void | |
file | File | null | |
loadingThe person's picture is on its way: the circle and the buttons are skeletons of their own boxes (pass the last known `value`, so the buttons are the ones that will come). | boolean | |
maxSize | number | 1024 * 1024 |
value | string | null |