avatar
lyse/avatarFreeComponent
lyse publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by lyse on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.getlyse.com/r/avatar.jsonSource
1import * as React from "react"2import { Slot } from "@radix-ui/react-slot"3import { cva, type VariantProps } from "class-variance-authority"4import { Plus, User } from "lucide-react"56import { cn } from "@/lib/utils"7import "./avatar.css"89/* ------------------------------------------------------------------ */10/* CVA */11/* ------------------------------------------------------------------ */1213const avatarVariants = cva(14 "avatar relative inline-flex items-center justify-center shrink-0 rounded-[var(--layout-radius-full)]",15 {16 variants: {17 size: {18 xs: "h-[var(--layout-size-md)] w-[var(--layout-size-md)]",19 sm: "h-[var(--layout-size-lg)] w-[var(--layout-size-lg)]",20 md: "h-[var(--layout-size-xl)] w-[var(--layout-size-xl)]",21 lg: "h-[var(--layout-size-2xl)] w-[var(--layout-size-2xl)]",22 xl: "h-[var(--layout-size-3xl)] w-[var(--layout-size-3xl)]",23 },24 },25 defaultVariants: {26 size: "md",27 },28 }29)3031const avatarStatusVariants = cva(32 "avatar-status absolute bottom-0 right-0 rounded-[var(--layout-radius-full)]",33 {34 variants: {35 size: {36 xs: "size-1.5",37 sm: "size-2",38 md: "size-2.5",39 lg: "size-3",40 xl: "size-3.5",41 },42 },43 defaultVariants: {44 size: "md",45 },46 }47)4849const avatarAddButtonVariants = cva(50 "avatar-add-button inline-flex items-center justify-center shrink-0 rounded-[var(--layout-radius-full)] p-[var(--layout-padding-xs)] cursor-pointer",51 {52 variants: {53 size: {54 xs: "h-[var(--layout-size-md)] w-[var(--layout-size-md)] [&_svg]:size-3",55 sm: "h-[var(--layout-size-lg)] w-[var(--layout-size-lg)] [&_svg]:h-[var(--layout-size-xs)] [&_svg]:w-[var(--layout-size-xs)]",56 md: "h-[var(--layout-size-xl)] w-[var(--layout-size-xl)] [&_svg]:h-[var(--layout-size-sm)] [&_svg]:w-[var(--layout-size-sm)]",57 },58 },59 defaultVariants: {60 size: "sm",61 },62 }63)6465/* ------------------------------------------------------------------ */66/* Avatar */67/* ------------------------------------------------------------------ */6869function Avatar({70 className,71 size = "md",72 src,73 alt = "",74 initials,75 status,76 companySrc,77 children,78 ref,79 ...props80}: React.ComponentProps<"div"> &81 VariantProps<typeof avatarVariants> & {82 src?: string83 alt?: string84// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from lyse
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| action-cardaction-card | lyse | Components | Free | no deps · 2 files | |
| alertalert | lyse | Components | Free | 2 deps · 2 files | |
| alert-dialogalert-dialog | lyse | Components | Free | 2 deps · 2 files | |
| badgebadge | lyse | Components | Free | 1 dep · 2 files | |
| banner-infobanner-info | lyse | Components | Free | 2 deps · 2 files | |
| breadcrumbbreadcrumb | lyse | Components | Free | 2 deps · 2 files | |
| buttonbutton | lyse | Components | Free | 2 deps · 2 files | |
| callout-cardcallout-card | lyse | Components | Free | 1 dep · 2 files |
