Alert Dialog
solid-ui/alert-dialogFreeComponent
An alert dialog 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/alert-dialog.jsonSource
1import type { JSX, ValidComponent } from "solid-js"2import { splitProps } from "solid-js"34import * as AlertDialogPrimitive from "@kobalte/core/alert-dialog"5import type { PolymorphicProps } from "@kobalte/core/polymorphic"67import { cn } from "~/lib/utils"89const AlertDialog = AlertDialogPrimitive.Root10const AlertDialogTrigger = AlertDialogPrimitive.Trigger11const AlertDialogPortal = AlertDialogPrimitive.Portal1213type AlertDialogOverlayProps<T extends ValidComponent = "div"> =14 AlertDialogPrimitive.AlertDialogOverlayProps<T> & {15 class?: string | undefined16 }1718const AlertDialogOverlay = <T extends ValidComponent = "div">(19 props: PolymorphicProps<T, AlertDialogOverlayProps<T>>20) => {21 const [local, others] = splitProps(props as AlertDialogOverlayProps, ["class"])22 return (23 <AlertDialogPrimitive.Overlay24 class={cn(25 "fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0",26 local.class27 )}28 {...others}29 />30 )31}3233type AlertDialogContentProps<T extends ValidComponent = "div"> =34 AlertDialogPrimitive.AlertDialogContentProps<T> & {35 class?: string | undefined36 children?: JSX.Element37 }3839const AlertDialogContent = <T extends ValidComponent = "div">(40 props: PolymorphicProps<T, AlertDialogContentProps<T>>41) => {42 const [local, others] = splitProps(props as AlertDialogContentProps, ["class", "children"])43 return (44 <AlertDialogPortal>45 <AlertDialogOverlay />46 <AlertDialogPrimitive.Content47 class={cn(48 "fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg duration-200 data-[expanded]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-[closed]:zoom-out-95 data-[expanded]:zoom-in-95 data-[closed]:slide-out-to-left-1/2 data-[closed]:slide-out-to-top-[48%] data-[expanded]:slide-in-from-left-1/2 data-[expanded]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",49 local.class50 )}51 {...others}52 >53 {local.children}54 <AlertDialogPrimitive.CloseButton 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-[expanded]:bg-accent data-[expanded]:text-muted-foreground">55 <svg56// … truncated
What it pulls in
npm packages
Files it writes
More from solid-ui
All 55 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | solid-ui | Components | Free | 2 deps | |
| Alertalert | solid-ui | Components | Free | 3 deps | |
| Aspect Ratioaspect-ratio | solid-ui | Components | Free | 1 dep | |
| Avataravatar | solid-ui | Components | Free | 2 deps | |
| Badgebadge | solid-ui | Components | Free | 2 deps | |
| Badge Deltabadge-delta | solid-ui | Components | Free | 2 deps | |
| Bar Listbar-list | solid-ui | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | solid-ui | Components | Free | 2 deps |
