Getting Started
Components
- Advanced Toast
- ArrowButton
- Arrows
- Avatar
- Backdrop
- Basic Toast
- Breadcrumb
- Button
- CardBackground
- Card
- ChatButton
- Checkbox
- Checkboxes
- Chip
- ChoiceExpander
- Clickable
- Date Field
- Dropdown
- ElasticHeight
- ExpandableCard
- Filter
- FormCheckbox
- Form Control
- Form Label
- HamburgerIcon
- Heading
- Image
- Link
- Loader
- Number Field
- Pagination
- Password
- Phone Field
- Popin
- Portal
- Prose
- Radio Group
- Radio
- Range
- Select
- SidebarLayout
- Spinner
- Switch
- Tabs
- Tag
- TextField
- ValidationMessage
Avatar using text:
Avatar using icon:
JD
Avatar using image:
JD
'use client';
import { Avatar } from '@/ui/Avatar';
import { Icon } from '@clubmed/trident-icons';
export function AvatarDemo() {
return (
<div>
Avatar using text:
<Avatar alt="John Doe" />
Avatar using image:
<Avatar alt="John Doe" src="https://randomuser.me/api/portraits/men/75.jpg" />
Avatar using icon:
<Avatar alt="John Doe">
<Icon name="PeopleSingle" width="24px" />
</Avatar>
</div>
);
}
Installation
npx shadcn@latest add https://develop.trident-ui.pro.clubmed/r/avatar.json
Usage
import Avatar from '@/docs/lib/ui/avatar';
export function Component() {
return <Avatar alt="John Doe" src="/path/to/image.jpg" />;
}API Reference
Avatar
| Prop | Type | Default | Description |
|---|---|---|---|
alt | string | undefined | Alt text for the image, or text used to generate initials when no image is provided |
src | string | undefined | undefined | The source URL for the avatar image |
srcSet | string | undefined | undefined | The srcSet attribute for responsive images |
className | string | undefined | Additional CSS classes. Defaults include rounded-full, text-black, and bg-saffron |
style | CSSProperties | { width: "48px", height: "48px" } | Custom inline styles. Default size is 48x48 pixels |
children | ReactNode | undefined | Optional children elements to overlay on the avatar |