Components
Avatar
Avatar
An image element with a fallback for representing the user.
Installation
npx shadcx@latest add avatar -r plate-ui
Examples
'use client';
import React from 'react';
import { CommentsPlugin } from '@udecode/plate-comments/react';
import { useEditorPlugin } from '@udecode/plate-common/react';
import { Avatar, AvatarFallback, AvatarImage } from './avatar';
export function CommentAvatar({ userId }: { userId: string | null }) {
const { useOption } = useEditorPlugin(CommentsPlugin);
const user = useOption('userById', userId);
if (!user) return null;
return (
<Avatar className="size-5">
<AvatarImage alt={user.name} src={user.avatarUrl} />
<AvatarFallback>{user.name?.[0]}</AvatarFallback>
</Avatar>
);
}
Build your editor even faster
Complete, deployable AI-powered template with backend.
All components included.
Customizable and extensible.
Get all-accessCustomizable and extensible.