BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/cubby-ui/avatar

Avatar

cubby-ui/avatar
FreeComponent

A avatar component.

Live preview

live · rendered by the registry
Rendered by cubby-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://cubby-ui.dev/r/avatar.json

Source

registry/default/avatar/avatar.tsxcubby-ui.dev/r/avatar.json
1"use client"
2
3import * as React from "react"
4import { Avatar as AvatarBase } from "@base-ui/react/avatar"
5import { cva, VariantProps } from "class-variance-authority"
6
7import { cn } from "@/lib/utils"
8
9const avatarVariants = cva(
10 "relative flex shrink-0 overflow-hidden rounded-full",
11 {
12 variants: {
13 size: {
14 sm: "size-8 text-sm",
15 md: "size-10",
16 lg: "size-12 text-lg",
17 },
18 },
19 defaultVariants: {
20 size: "md",
21 },
22 }
23)
24
25function Avatar({
26 className,
27 size,
28 ...props
29}: React.ComponentProps<typeof AvatarBase.Root> &
30 VariantProps<typeof avatarVariants>) {
31 return (
32 <AvatarBase.Root
33 data-slot="avatar"
34 className={cn(avatarVariants({ size }), className)}
35 {...props}
36 />
37 )
38}
39
40function AvatarImage({
41 className,
42 ...props
43}: React.ComponentProps<typeof AvatarBase.Image>) {
44 return (
45 <AvatarBase.Image
46 data-slot="avatar-image"
47 className={cn("size-full object-cover", className)}
48 {...props}
49 />
50 )
51}
52
53function AvatarFallback({
54 className,
55 ...props
56}: React.ComponentProps<typeof AvatarBase.Fallback>) {
57 return (
58 <AvatarBase.Fallback
59 data-slot="avatar-fallback"
60 className={cn(
61 "bg-muted flex size-full items-center justify-center rounded-full select-none",
62 className
63 )}
64 {...props}
65 />
66 )
67}
68
69export { Avatar, AvatarImage, AvatarFallback }

What it pulls in

npm packages

  • class-variance-authority

Files it writes

  • registry/default/avatar/avatar.tsx

Facts

Registry
cubby-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
2 days ago

Go to the source

Docs on cubby-ui cubby-ui.dev joncoronel/cubby-ui on GitHub Raw registry item This item as JSON

More from cubby-ui

All 79 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordioncubby-uiComponentsFree2 deps
Alertalertcubby-uiComponentsFree1 dep
Alert-dialogalert-dialogcubby-uiComponentsFree2 deps
Aspect-ratioaspect-ratiocubby-uiComponentsFreeno deps
Autocompleteautocompletecubby-uiComponentsFree2 deps
Badgebadgecubby-uiComponentsFree1 dep
Base Drawerbase-drawercubby-uiComponentsFree2 deps
Breadcrumbsbreadcrumbscubby-uiComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex