Data display
Avatar, AvatarGroup
A person's picture, or their initials when there is none. A group shows the first few and a count of the rest.
import { Avatar, AvatarGroup, initials } from "@percentsa/ui";Examples
Code
export function AvatarExample() {
const t = useT();
return (
<Inline gap={4}>
<Avatar size="sm" name={t("Sara Ahmed", "سارة أحمد")} />
<Avatar name={t("Mohammed Alotaibi", "محمد العتيبي")} />
<Avatar size="lg" name={t("Nora Alqahtani", "نورة القحطاني")} />
</Inline>
);
}+2
+3
Code
export function AvatarGroupExample() {
const t = useT();
const people = [
t("Sara Ahmed", "سارة أحمد"),
t("Mohammed Alotaibi", "محمد العتيبي"),
t("Nora Alqahtani", "نورة القحطاني"),
t("Omar Fahd", "عمر فهد"),
t("Lina Adel", "لينا عادل"),
t("Khalid Saleh", "خالد صالح"),
];
return (
<Stack gap={4}>
<AvatarGroup max={4}>
{people.map((name) => (
<Avatar key={name} name={name} />
))}
</AvatarGroup>
<AvatarGroup max={3} size="sm">
{people.map((name) => (
<Avatar key={name} size="sm" name={name} />
))}
</AvatarGroup>
</Stack>
);
}