āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/adityakishore0/scrollx-ui/components/avatar ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
<ComponentPreview name="avatar-demo" className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]" description="An accessible Avatar component built with Radix UI" />
<Step>Install the following dependencies:</Step> <DepsOptions name="@radix-ui/react-avatar" />
<Step>Copy and paste the following code into your project.</Step>
<p> <code>avatar.tsx</code> </p> <ComponentSource name="avatar" /><Step>Add util file</Step>
<p> <code>lib/utils.ts</code> </p>import { ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
</Steps>
</TabsContent>
</Tabs>
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar"
<Avatar variant="close-friends">
<AvatarImage src="https://github.com/Adityakishore0.png" alt="@Ahdeetai" />
<AvatarFallback>AK</AvatarFallback>
</Avatar>
<Avatar variant="none">
<AvatarImage src="https://github.com/Adityakishore0.png" alt="@Ahdeetai" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<Avatar variant="close-friends">
<AvatarImage src="https://github.com/Adityakishore0.png" alt="@Ahdeetai" />
<AvatarFallback>AK</AvatarFallback>
</Avatar>
<Avatar variant="normal">
<AvatarImage src="https://github.com/Adityakishore0.png" alt="@Ahdeetai" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
The root container for the Avatar component.
<PropsTable
rows={[
{
prop: "variant",
type: "close-friends" | "normal" | "none",
default: "none",
description: "Controls the style variant of the avatar. Used in Avatar."
},
{
prop: "src",
type: "string",
default: "ā",
description: "Image source URL. Used in AvatarImage."
},
{
prop: "alt",
type: "string",
default: "ā",
description: "Accessible alt text for the image. Used in AvatarImage."
},
{
prop: "children",
type: "ReactNode",
default: "required",
description: "Nested content. Used in Avatar and AvatarFallback."
},
{
prop: "className",
type: "string",
default: "ā",
description: "Optional styling class. Used in Avatar, AvatarImage, and AvatarFallback."
}
]}
/>
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā