- Accordion
- Action Bar
- Action Toast
- Alert Banner
- Alert Dialog
- Alert
- Alphabet Index
- Amount Field
- Aspect Ratio
- Attachment
- Availability List
- Avatar
- Badge
- Bank Card
- Breadcrumb
- Bubble
- Button Group
- Button
- Calendar
- Camera Frame
- Card Design Picker
- Card Details
- Card Peek
- Card Stack
- Card
- Carousel
- Chart
- Chat Thread
- Checkbox
- Chip Group
- Choice Tile
- Code Block
- Code Dots
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Field
- Countdown
- Country Select
- Data Table
- Date Field
- Date Picker
- Date Range Picker
- Dialog
- Direction
- Document Paper
- Drawer
- Dropdown Menu
- Empty
- Entity Avatar
- Field
- File Trigger
- File Upload Item
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Key Value
- Keypad
- Label
- Live Region
- Marker
- Message Scroller
- Message
- Money Amount
- Native Select
- Number Field
- Pagination
- Percent Split Editor
- Phone Field
- Popover
- Progress
- QR Code
- Questionnaire
- Radio Group
- Range Histogram
- Rating
- Resizable
- Scroll Area
- Search Field
- Select
- Separator
- Share Bar
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Sortable List
- Spinner
- Status Timeline
- Step Header
- Steps List
- Swipe Row
- Switch
- Table
- Tabs
- Text Field
- Textarea
- Tier Ladder
- Toggle Group
- Toggle
- Token Search Field
- Tooltip
- Trace
- Transaction Row
- Usage Meter
import {
Avatar,
AvatarBadge,
Installation#
pnpm dlx shadcn@latest add @dots/avatar
Usage#
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"<Avatar>
<AvatarImage src="https://avatar.vercel.sh/dots" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>Composition#
Use the following composition to build an Avatar:
Avatar
├── AvatarImage
├── AvatarFallback
└── AvatarBadgeUse the following composition to build an AvatarGroup:
AvatarGroup
├── Avatar
│ ├── AvatarImage
│ ├── AvatarFallback
│ └── AvatarBadge
├── Avatar
│ ├── AvatarImage
│ ├── AvatarFallback
│ └── AvatarBadge
└── AvatarGroupCountBasic#
A basic avatar component with an image and a fallback.
import {
Avatar,
AvatarFallback,
Badge#
Use the AvatarBadge component to add a badge to the avatar. The badge is positioned at the bottom right of the avatar.
import {
Avatar,
AvatarBadge,
Use the className prop to add custom styles to the badge such as custom colors, sizes, etc.
<Avatar>
<AvatarImage src="https://avatar.vercel.sh/dots" alt="Avatar" />
<AvatarFallback>CN</AvatarFallback>
<AvatarBadge className="bg-green-600 dark:bg-green-800" />
</Avatar>Badge with Icon#
You can also use an icon inside <AvatarBadge>.
import { PlusIcon } from "lucide-react"
import {
Avatar Group#
Use the AvatarGroup component to add a group of avatars.
import {
Avatar,
AvatarFallback,
Avatar Group Count#
Use <AvatarGroupCount> to add a count to the group.
import {
Avatar,
AvatarFallback,
Avatar Group with Icon#
You can also use an icon inside <AvatarGroupCount>.
import { PlusIcon } from "lucide-react"
import {
Sizes#
Use the size prop to change the size of the avatar.
import {
Avatar,
AvatarFallback,
Dropdown#
You can use the Avatar component as a trigger for a dropdown menu.
"use client"
import {
API Reference#
Avatar#
The Avatar component is the root component that wraps the avatar image and fallback.
| Prop | Type | Default |
|---|---|---|
size | "default" | "sm" | "lg" | "default" |
className | string | - |
AvatarImage#
The AvatarImage component displays the avatar image.
| Prop | Type | Default |
|---|---|---|
src | string | - |
alt | string | - |
className | string | - |
AvatarFallback#
The AvatarFallback component displays a fallback when the image fails to load.
| Prop | Type | Default |
|---|---|---|
className | string | - |
AvatarBadge#
The AvatarBadge component displays a badge indicator on the avatar, typically positioned at the bottom right.
| Prop | Type | Default |
|---|---|---|
className | string | - |
AvatarGroup#
The AvatarGroup component displays a group of avatars with overlapping styling.
| Prop | Type | Default |
|---|---|---|
className | string | - |
AvatarGroupCount#
The AvatarGroupCount component displays a count indicator in an avatar group, typically showing the number of additional avatars.
| Prop | Type | Default |
|---|---|---|
className | string | - |