Avatar
Round avatar: image or initials on a fruit color derived from the name.
Code
import * as React from 'react';
import { Avatar, AvatarGroup } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
display: 'flex',
gap: 12,
alignItems: 'center',
}}
>
<Avatar name="Ada Lovelace" />
<Avatar name="Marco Kim" size={32} />
<AvatarGroup people={['Ada L', 'Marco K', 'Jia S', 'Rosa T', 'Sam P', 'Lee W']} />
</div>
);
}Sizes
import { Avatar } from '@fruit-labs/design';
export default function Example() {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 12, alignItems: 'center' }}>
<Avatar name="Ada Lovelace" size={28} />
<Avatar name="Marco Kim" size={40} />
<Avatar name="Jia Song" size={56} />
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { Avatar } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/avatar.jsonGuidelines
- Sizes 24 (dense), 32 (tables), 40 (default), 56+ (profiles).
Props
| Prop | Type | Required |
|---|---|---|
name | string | No |
src | string | No |
size | number | No |
color | string | No |
className | string | No |