Avatar
rivelle/avatarFreeComponent
An image avatar with a reliable fallback.
Live preview
live · rendered by the registry
Rendered by rivelle on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://rivelle.dev/r/avatar.jsonSource
1"use client"23import * as React from "react"4import * as AvatarPrimitive from "@radix-ui/react-avatar"56import { cn } from "@/lib/utils"78function Avatar({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root>) { return <AvatarPrimitive.Root data-slot="avatar" className={cn("relative flex size-9 shrink-0 overflow-hidden rounded-xl border border-foreground/10 bg-foreground/[.04] shadow-[inset_0_1px_0_color-mix(in_oklch,var(--background)_60%,transparent),0_8px_20px_-14px_var(--foreground)]", className)} {...props} /> }9function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) { return <AvatarPrimitive.Image data-slot="avatar-image" className={cn("aspect-square size-full object-cover", className)} {...props} /> }10function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) { return <AvatarPrimitive.Fallback data-slot="avatar-fallback" className={cn("flex size-full items-center justify-center rounded-[inherit] bg-primary/8 text-xs font-semibold tracking-[-0.01em] text-primary", className)} {...props} /> }1112export { Avatar, AvatarFallback, AvatarImage }
What it pulls in
npm packages
Other registry items
Files it writes
More from rivelle
All 83 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | rivelle | Components | Free | 2 deps | |
| Alertalert | rivelle | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | rivelle | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | rivelle | Components | Free | 1 dep | |
| Badgebadge | rivelle | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | rivelle | Components | Free | 2 deps | |
| Buttonbutton | rivelle | Components | Free | 2 deps | |
| Button Groupbutton-group | rivelle | Components | Free | no deps |
