dialog
adrianub/dialogFreeComponent
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/dialog.jsonSource
1import type { TemplateRef } from '@angular/core'2import type { RdxDialogConfig } from '@radix-ng/primitives/dialog'3import { Component, computed, Directive, effect, inject, input } from '@angular/core'4import { NgIconComponent, provideIcons } from '@ng-icons/core'5import { lucideX } from '@ng-icons/lucide'67import {8 RdxDialogCloseDirective,910 RdxDialogContentDirective,11 RdxDialogDescriptionDirective,12 RdxDialogTitleDirective,13 RdxDialogTriggerDirective,14} from '@radix-ng/primitives/dialog'15import { cn } from '~/lib/utils'1617@Directive({18 standalone: true,19 selector: 'button[ubDialogClose]',20 hostDirectives: [RdxDialogCloseDirective],21})22export class UbDialogCloseDirective {}2324@Directive({25 standalone: true,26 selector: '[ubDialogTrigger]',27 hostDirectives: [28 {29 directive: RdxDialogTriggerDirective,30 inputs: ['rdxDialogTrigger: ubDialogTrigger'],31 },32 ],33})34export class UbDialogTriggerDirective {35 rdxDialogTrigger = inject(RdxDialogTriggerDirective, { host: true })36 ubDialogTrigger = input.required<TemplateRef<void>>()37 ubDialogConfig = input<RdxDialogConfig<unknown>>()3839 passingConfig = effect(() => {40 this.rdxDialogTrigger.dialogConfig = {41 ...this.ubDialogConfig(),42 content: this.ubDialogTrigger(),43 backdropClass: ['fixed', 'inset-0', 'z-50', 'bg-black/80', 'data-[state=open]:animate-in', 'data-[state=closed]:animate-out', 'data-[state=closed]:fade-out-0', 'data-[state=open]:fade-in-0'],44 }45 })46}4748@Component({49 standalone: true,50 selector: '[ubDialogContent]',51 imports: [RdxDialogCloseDirective, NgIconComponent],52 host: {53 '[class]': 'computedClass()',54 },55 hostDirectives: [56 {57 directive: RdxDialogContentDirective,58 },59 ],60 viewProviders: [provideIcons({ lucideX })],61 template: `62 <ng-content />6364 <button class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground" rdxDialogClose>65 <ng-icon name="lucideX" />66 <span class="sr-only">Close</span>67 </button>68 `,69})70export class UbDialogContentDirective {71 class = input<string>()72// … truncated
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 | |
| avataravatar | 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 |
