mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +00:00
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in: - [email protected] through [email protected] releases - New apps/v4 directory structure - Registry system improvements and MCP server - Framework support (Vue, Svelte, React Native) - New templates (vite-app, monorepo-next, laravel) - Zod 4 compatibility (scoped override for zod@>4) - Test fixture corrections for alias resolution All 867 merge conflicts resolved preserving Hanzo customizations. 1020/1020 shadcn tests pass.
512 lines
14 KiB
TypeScript
512 lines
14 KiB
TypeScript
import {
|
|
Example,
|
|
ExampleWrapper,
|
|
} from "@/registry/bases/base/components/example"
|
|
import {
|
|
Avatar,
|
|
AvatarBadge,
|
|
AvatarFallback,
|
|
AvatarGroup,
|
|
AvatarGroupCount,
|
|
AvatarImage,
|
|
} from "@/registry/bases/base/ui/avatar"
|
|
import { Button } from "@/registry/bases/base/ui/button"
|
|
import {
|
|
Empty,
|
|
EmptyContent,
|
|
EmptyDescription,
|
|
EmptyHeader,
|
|
EmptyMedia,
|
|
EmptyTitle,
|
|
} from "@/registry/bases/base/ui/empty"
|
|
import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder"
|
|
|
|
export default function AvatarExample() {
|
|
return (
|
|
<ExampleWrapper>
|
|
<AvatarSizes />
|
|
<AvatarWithBadge />
|
|
<AvatarWithBadgeIcon />
|
|
<AvatarGroupExample />
|
|
<AvatarGroupWithCount />
|
|
<AvatarGroupWithIconCount />
|
|
<AvatarInEmpty />
|
|
</ExampleWrapper>
|
|
)
|
|
}
|
|
|
|
function AvatarSizes() {
|
|
return (
|
|
<Example title="Sizes">
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
<Avatar size="sm">
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
</div>
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
<Avatar size="sm">
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
</div>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AvatarWithBadge() {
|
|
return (
|
|
<Example title="Badge">
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
<Avatar size="sm">
|
|
<AvatarImage
|
|
src="https://github.com/jorgezreik.png"
|
|
alt="@jorgezreik"
|
|
/>
|
|
<AvatarFallback>JZ</AvatarFallback>
|
|
<AvatarBadge />
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarImage
|
|
src="https://github.com/jorgezreik.png"
|
|
alt="@jorgezreik"
|
|
/>
|
|
<AvatarFallback>JZ</AvatarFallback>
|
|
<AvatarBadge />
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/jorgezreik.png"
|
|
alt="@jorgezreik"
|
|
/>
|
|
<AvatarFallback>JZ</AvatarFallback>
|
|
<AvatarBadge />
|
|
</Avatar>
|
|
</div>
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
<Avatar size="sm">
|
|
<AvatarFallback>JZ</AvatarFallback>
|
|
<AvatarBadge />
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarFallback>JZ</AvatarFallback>
|
|
<AvatarBadge />
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarFallback>JZ</AvatarFallback>
|
|
<AvatarBadge />
|
|
</Avatar>
|
|
</div>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AvatarWithBadgeIcon() {
|
|
return (
|
|
<Example title="Badge with Icon">
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
<Avatar size="sm">
|
|
<AvatarImage
|
|
src="https://github.com/pranathip.png"
|
|
alt="@pranathip"
|
|
/>
|
|
<AvatarFallback>PP</AvatarFallback>
|
|
<AvatarBadge>
|
|
<IconPlaceholder
|
|
lucide="PlusIcon"
|
|
tabler="IconPlus"
|
|
hugeicons="PlusSignIcon"
|
|
phosphor="PlusIcon"
|
|
remixicon="RiAddLine"
|
|
/>
|
|
</AvatarBadge>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarImage
|
|
src="https://github.com/pranathip.png"
|
|
alt="@pranathip"
|
|
/>
|
|
<AvatarFallback>PP</AvatarFallback>
|
|
<AvatarBadge>
|
|
<IconPlaceholder
|
|
lucide="PlusIcon"
|
|
tabler="IconPlus"
|
|
hugeicons="PlusSignIcon"
|
|
phosphor="PlusIcon"
|
|
remixicon="RiAddLine"
|
|
/>
|
|
</AvatarBadge>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/pranathip.png"
|
|
alt="@pranathip"
|
|
/>
|
|
<AvatarFallback>PP</AvatarFallback>
|
|
<AvatarBadge>
|
|
<IconPlaceholder
|
|
lucide="PlusIcon"
|
|
tabler="IconPlus"
|
|
hugeicons="PlusSignIcon"
|
|
phosphor="PlusIcon"
|
|
remixicon="RiAddLine"
|
|
/>
|
|
</AvatarBadge>
|
|
</Avatar>
|
|
</div>
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
<Avatar size="sm">
|
|
<AvatarFallback>PP</AvatarFallback>
|
|
<AvatarBadge>
|
|
<IconPlaceholder
|
|
lucide="CheckIcon"
|
|
tabler="IconCheck"
|
|
hugeicons="Tick02Icon"
|
|
phosphor="CheckIcon"
|
|
remixicon="RiCheckLine"
|
|
/>
|
|
</AvatarBadge>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarFallback>PP</AvatarFallback>
|
|
<AvatarBadge>
|
|
<IconPlaceholder
|
|
lucide="CheckIcon"
|
|
tabler="IconCheck"
|
|
hugeicons="Tick02Icon"
|
|
phosphor="CheckIcon"
|
|
remixicon="RiCheckLine"
|
|
/>
|
|
</AvatarBadge>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarFallback>PP</AvatarFallback>
|
|
<AvatarBadge>
|
|
<IconPlaceholder
|
|
lucide="CheckIcon"
|
|
tabler="IconCheck"
|
|
hugeicons="Tick02Icon"
|
|
phosphor="CheckIcon"
|
|
remixicon="RiCheckLine"
|
|
/>
|
|
</AvatarBadge>
|
|
</Avatar>
|
|
</div>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AvatarGroupExample() {
|
|
return (
|
|
<Example title="Group">
|
|
<AvatarGroup>
|
|
<Avatar size="sm">
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="sm">
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="sm">
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
</AvatarGroup>
|
|
<AvatarGroup>
|
|
<Avatar>
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
</AvatarGroup>
|
|
<AvatarGroup>
|
|
<Avatar size="lg">
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
</AvatarGroup>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AvatarGroupWithCount() {
|
|
return (
|
|
<Example title="Group with Count">
|
|
<AvatarGroup>
|
|
<Avatar size="sm">
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="sm">
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="sm">
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
<AvatarGroupCount>+3</AvatarGroupCount>
|
|
</AvatarGroup>
|
|
<AvatarGroup>
|
|
<Avatar>
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
<AvatarGroupCount>+3</AvatarGroupCount>
|
|
</AvatarGroup>
|
|
<AvatarGroup>
|
|
<Avatar size="lg">
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
<AvatarGroupCount>+3</AvatarGroupCount>
|
|
</AvatarGroup>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AvatarGroupWithIconCount() {
|
|
return (
|
|
<Example title="Group with Icon Count">
|
|
<AvatarGroup>
|
|
<Avatar size="sm">
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="sm">
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="sm">
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
<AvatarGroupCount>
|
|
<IconPlaceholder
|
|
lucide="PlusIcon"
|
|
tabler="IconPlus"
|
|
hugeicons="PlusSignIcon"
|
|
phosphor="PlusIcon"
|
|
remixicon="RiAddLine"
|
|
/>
|
|
</AvatarGroupCount>
|
|
</AvatarGroup>
|
|
<AvatarGroup>
|
|
<Avatar>
|
|
<AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar>
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
<AvatarGroupCount>
|
|
<IconPlaceholder
|
|
lucide="PlusIcon"
|
|
tabler="IconPlus"
|
|
hugeicons="PlusSignIcon"
|
|
phosphor="PlusIcon"
|
|
remixicon="RiAddLine"
|
|
/>
|
|
</AvatarGroupCount>
|
|
</AvatarGroup>
|
|
<AvatarGroup>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/shadcn.png"
|
|
alt="@shadcn"
|
|
className="grayscale"
|
|
/>
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
className="grayscale"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
className="grayscale"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
<AvatarGroupCount>
|
|
<IconPlaceholder
|
|
lucide="PlusIcon"
|
|
tabler="IconPlus"
|
|
hugeicons="PlusSignIcon"
|
|
phosphor="PlusIcon"
|
|
remixicon="RiAddLine"
|
|
/>
|
|
</AvatarGroupCount>
|
|
</AvatarGroup>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function AvatarInEmpty() {
|
|
return (
|
|
<Example title="In Empty">
|
|
<Empty className="w-full flex-none border">
|
|
<EmptyHeader>
|
|
<EmptyMedia>
|
|
<AvatarGroup>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/shadcn.png"
|
|
alt="@shadcn"
|
|
className="grayscale"
|
|
/>
|
|
<AvatarFallback>CN</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/maxleiter.png"
|
|
alt="@maxleiter"
|
|
className="grayscale"
|
|
/>
|
|
<AvatarFallback>LR</AvatarFallback>
|
|
</Avatar>
|
|
<Avatar size="lg">
|
|
<AvatarImage
|
|
src="https://github.com/evilrabbit.png"
|
|
alt="@evilrabbit"
|
|
className="grayscale"
|
|
/>
|
|
<AvatarFallback>ER</AvatarFallback>
|
|
</Avatar>
|
|
<AvatarGroupCount>
|
|
<IconPlaceholder
|
|
lucide="PlusIcon"
|
|
tabler="IconPlus"
|
|
hugeicons="PlusSignIcon"
|
|
phosphor="PlusIcon"
|
|
remixicon="RiAddLine"
|
|
/>
|
|
</AvatarGroupCount>
|
|
</AvatarGroup>
|
|
</EmptyMedia>
|
|
<EmptyTitle>No Team Members</EmptyTitle>
|
|
<EmptyDescription>
|
|
Invite your team to collaborate on this project.
|
|
</EmptyDescription>
|
|
</EmptyHeader>
|
|
<EmptyContent>
|
|
<Button>
|
|
<IconPlaceholder
|
|
lucide="PlusIcon"
|
|
tabler="IconPlus"
|
|
hugeicons="PlusSignIcon"
|
|
phosphor="PlusIcon"
|
|
remixicon="RiAddLine"
|
|
/>
|
|
Invite Members
|
|
</Button>
|
|
</EmptyContent>
|
|
</Empty>
|
|
</Example>
|
|
)
|
|
}
|