avatar
adrianub/avatarFreeComponent
adrianub publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by adrianub on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.adrianub.dev/r/styles/new-york/avatar.jsonSource
1import { computed, Directive, input } from '@angular/core'2import { RdxAvatarFallbackDirective, RdxAvatarImageDirective, RdxAvatarRootDirective } from '@radix-ng/primitives/avatar'34import { cn } from '~/lib/utils'56@Directive({7 standalone: true,8 selector: 'span[ubAvatar]',9 hostDirectives: [RdxAvatarRootDirective],10 host: {11 '[class]': 'computedClass()',12 },13})14export class UbAvatarDirective {15 readonly class = input<string>()1617 readonly computedClass = computed(() => {18 return cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', this.class())19 })20}2122@Directive({23 standalone: true,24 selector: 'img[ubAvatarImage]',25 hostDirectives: [26 {27 directive: RdxAvatarImageDirective,28 inputs: ['src'],29 },30 ],31 host: {32 '[class]': 'computedClass()',33 },34})35export class UbAvatarImageDirective {36 readonly class = input<string>()3738 readonly computedClass = computed(() => {39 return cn('aspect-square h-full w-full', this.class())40 })41}4243@Directive({44 standalone: true,45 selector: 'span[ubAvatarFallback]',46 hostDirectives: [47 {48 directive: RdxAvatarFallbackDirective,49 inputs: ['delayMs'],50 },51 ],52 host: {53 '[class]': 'computedClass()',54 },55})56export class UbAvatarFallbackDirective {57 readonly class = input<string>()5859 readonly computedClass = computed(() => {60 return cn('flex h-full w-full items-center justify-center rounded-full bg-muted', this.class())61 })62}
What it pulls in
npm packages
Files it writes
More from adrianub
All 23 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | adrianub | Components | Free | 1 dep | |
| alertalert | adrianub | Components | Free | no deps | |
| aspect-ratioaspect-ratio | adrianub | Components | Free | 1 dep | |
| badgebadge | adrianub | Components | Free | no deps | |
| breadcrumbbreadcrumb | adrianub | Components | Free | no deps | |
| buttonbutton | adrianub | Components | Free | no deps | |
| cardcard | adrianub | Components | Free | no deps | |
| collapsiblecollapsible | adrianub | Components | Free | 1 dep |
