BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/solid-ui/avatar

Avatar

solid-ui/avatar
FreeComponent

An avatar component

Live preview

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

Install it

npx shadcn@latest add https://www.solid-ui.com/r/avatar.json

Source

src/registry/ui/avatar.tsxwww.solid-ui.com/r/avatar.json
1import type { ValidComponent } from "solid-js"
2import { splitProps } from "solid-js"
3
4import * as ImagePrimitive from "@kobalte/core/image"
5import type { PolymorphicProps } from "@kobalte/core/polymorphic"
6
7import { cn } from "~/lib/utils"
8
9type AvatarRootProps<T extends ValidComponent = "span"> = ImagePrimitive.ImageRootProps<T> & {
10 class?: string | undefined
11}
12
13const Avatar = <T extends ValidComponent = "span">(
14 props: PolymorphicProps<T, AvatarRootProps<T>>
15) => {
16 const [local, others] = splitProps(props as AvatarRootProps, ["class"])
17 return (
18 <ImagePrimitive.Root
19 class={cn("relative flex size-10 shrink-0 overflow-hidden rounded-full", local.class)}
20 {...others}
21 />
22 )
23}
24
25type AvatarImageProps<T extends ValidComponent = "img"> = ImagePrimitive.ImageImgProps<T> & {
26 class?: string | undefined
27}
28
29const AvatarImage = <T extends ValidComponent = "img">(
30 props: PolymorphicProps<T, AvatarImageProps<T>>
31) => {
32 const [local, others] = splitProps(props as AvatarImageProps, ["class"])
33 return <ImagePrimitive.Img class={cn("aspect-square size-full", local.class)} {...others} />
34}
35
36type AvatarFallbackProps<T extends ValidComponent = "span"> =
37 ImagePrimitive.ImageFallbackProps<T> & { class?: string | undefined }
38
39const AvatarFallback = <T extends ValidComponent = "span">(
40 props: PolymorphicProps<T, AvatarFallbackProps<T>>
41) => {
42 const [local, others] = splitProps(props as AvatarFallbackProps, ["class"])
43 return (
44 <ImagePrimitive.Fallback
45 class={cn("flex size-full items-center justify-center bg-muted", local.class)}
46 {...others}
47 />
48 )
49}
50
51export { Avatar, AvatarImage, AvatarFallback }

What it pulls in

npm packages

  • solid-js
  • @kobalte/core

Files it writes

  • src/registry/ui/avatar.tsx

Facts

Registry
solid-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on solid-ui www.solid-ui.com stefan-karger/solid-ui on GitHub Raw registry item This item as JSON

More from solid-ui

All 55 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionsolid-uiComponentsFree2 deps
Alertalertsolid-uiComponentsFree3 deps
Alert Dialogalert-dialogsolid-uiComponentsFree2 deps
Aspect Ratioaspect-ratiosolid-uiComponentsFree1 dep
Badgebadgesolid-uiComponentsFree2 deps
Badge Deltabadge-deltasolid-uiComponentsFree2 deps
Bar Listbar-listsolid-uiComponentsFree1 dep
Breadcrumbbreadcrumbsolid-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