ui/avatar.tsx

helmor · src/components/ui/avatar.tsx · typescript · Apache-2.0
ui

Module exposing: Avatar, AvatarImage, AvatarBadge, AvatarFallback

// Source: https://github.com/dohooo/helmor | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import * as AvatarPrimitive from "@radix-ui/react-avatar";
import { cva, type VariantProps } from "class-variance-authority";
import type * as React from "react";

import { cn } from "../../lib/utils";

const avatarVariants = cva("relative inline-flex shrink-0 rounded-full", {
	variants: {
		size: {
			default: "size-8",
			sm: "size-6",
			lg: "size-10",
		},
	},
	defaultVariants: {
		size: "default",
	},
});

type AvatarProps = React.ComponentProps<typeof AvatarPrimitive.Root> &
	VariantProps<typeof avatarVariants>;

function Avatar({ className, size, ...props }: AvatarProps) {
	return (


... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key