Avatar User
To use the Avatar component you have to import from @/components/user/avatar/avatar-user
.
Component requires sizeInRem
prop to be passed.
ℹ️
1rem === 16px
Current User
If you want to display the user avatar, you need to pass a user object with:
id
- user's idname
- user's nameavatar
- user'sUploadCoreAttachmentsObj
interface,avatar_color
- user's avatar color
import { AvatarUser } from '@/components/user/avatar/avatar-user';
<AvatarUser
user={{
avatar,
name,
id,
avatar_color
}}
sizeInRem={1.75}
/>;
Current User
If you want to display the user avatar, you need to pass a user object form useSession
or useSessionAdmin
(if you want to use in AdminCP) hook.
import { AvatarUser } from '@/components/user/avatar/avatar-user';
import { useSession } from '@/hooks/core/use-session';
const { session } = useSession();
if (!session) return null;
return <AvatarUser user={session} sizeInRem={1.75} />;