Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
- Typography
CNAP
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/ui/avatar";
Installation
$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.com/r/avatar.json
Usage
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/ui/avatar/avatar";<Avatar>
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>Composition
Use the following composition to build a Avatar:
Avatar
├── AvatarImage
└── AvatarFallbackExamples
Basic
CNAP
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/ui/avatar";
Badge
Use AvatarBadge to display a status indicator.
CN
import {
Avatar,
AvatarBadge,
AvatarFallback,
AvatarImage,
} from "@/components/ui/avatar";Badge with Icon
PP
import { PlusIcon } from "lucide-react";
import {
Avatar,
AvatarBadge,
AvatarFallback,Avatar Group
Use AvatarGroup to display overlapping avatars.
CNLRER
import {
Avatar,
AvatarFallback,
AvatarGroup,
AvatarImage,
} from "@/components/ui/avatar";Avatar Group Count
Use AvatarGroupCount to display a count of additional members.
CNLRER
+3
import {
Avatar,
AvatarFallback,
AvatarGroup,
AvatarGroupCount,
AvatarImage,Avatar Group with Icon
CNLRER
import { PlusIcon } from "lucide-react";
import {
Avatar,
AvatarFallback,
AvatarGroup,Sizes
Use the size prop to change the avatar size.
CNCNCN
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/ui/avatar";
Dropdown
"use client";
import {
Avatar,
AvatarFallback,
AvatarImage,RTL
To enable right-to-left support, see the RTL guide.
CNAP
"use client";
import { useTranslation } from "@/components/language-selector";
import type { Translations } from "@/components/language-selector";
import {
Avatar,API Reference
See the Base UI documentation for the full API.