Alert Dialog
adn-ui/alert-dialogFreeComponent
A modal dialog that interrupts the user with important information.
Live preview
live · rendered by the registry
Rendered by adn-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.awaiden.com/r/alert-dialog.jsonSource
1"use client";23import "./alert-dialog.css";4import { AlertDialog as BaseAlertDialog } from "@base-ui/react/alert-dialog";5import React from "react";6import { cn } from "tailwind-variants";78import { AlertDialogContext, useAlertDialogContext } from "./alert-dialog.context";9import { alertDialogVariants, type AlertDialogVariants } from "./alert-dialog.variants";1011export type AlertDialogProps = AlertDialogVariants &12 React.ComponentProps<typeof BaseAlertDialog.Root>;1314export const AlertDialogRoot = ({ children, size, variant, ...props }: AlertDialogProps) => {15 const slots = alertDialogVariants({ size, variant });1617 return (18 <AlertDialogContext.Provider value={{ slots }}>19 <BaseAlertDialog.Root {...props}>{children}</BaseAlertDialog.Root>20 </AlertDialogContext.Provider>21 );22};2324export type AlertDialogTriggerProps = React.ComponentProps<typeof BaseAlertDialog.Trigger> & {25 render?: React.ReactElement;26 asChild?: boolean;27};2829export const AlertDialogTrigger = ({30 className,31 children,32 render,33 asChild: _asChild,34 ...props35}: AlertDialogTriggerProps) => {36 const { slots } = useAlertDialogContext();37 const renderElement = render ?? (React.isValidElement(children) ? children : undefined);38 return (39 <BaseAlertDialog.Trigger40 className={cn(slots.trigger(), className)}41 {...props}42 {...(renderElement ? { render: renderElement } : { children })}43 />44 );45};4647export type AlertDialogPortalProps = React.ComponentProps<typeof BaseAlertDialog.Portal>;4849export const AlertDialogPortal = (props: AlertDialogPortalProps) => {50 return <BaseAlertDialog.Portal {...props} />;51};5253export type AlertDialogBackdropProps = React.ComponentProps<typeof BaseAlertDialog.Backdrop>;5455export const AlertDialogBackdrop = ({ className, ...props }: AlertDialogBackdropProps) => {56 const { slots } = useAlertDialogContext();57 return <BaseAlertDialog.Backdrop className={cn(slots.backdrop(), className)} {...props} />;58};5960export const AlertDialogOverlay = AlertDialogBackdrop;61export type AlertDialogOverlayProps = AlertDialogBackdropProps;6263export type AlertDialogPopupProps = React.ComponentProps<typeof BaseAlertDialog.Popup>;6465export const AlertDialogPopup = ({ className, ...props }: AlertDialogPopupProps) => {66 const { slots } = useAlertDialogContext();67 return <BaseAlertDialog.Popup className={cn(slots.popup(), className)} {...props} />;68};6970export type AlertDialogTitleProps = React.ComponentProps<typeof BaseAlertDialog.Title>;7172// … truncated
What it pulls in
npm packages
Files it writes
More from adn-ui
All 46 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | adn-ui | Components | Free | 2 deps · 5 files | |
| Aspect Ratioaspect-ratio | adn-ui | Components | Free | 1 dep · 5 files | |
| Autocompleteautocomplete | adn-ui | Components | Free | 2 deps · 5 files | |
| Avataravatar | adn-ui | Components | Free | 2 deps · 5 files | |
| Badgebadge | adn-ui | Components | Free | 1 dep · 5 files | |
| Breadcrumbbreadcrumb | adn-ui | Components | Free | 1 dep · 5 files | |
| Buttonbutton | adn-ui | Components | Free | 1 dep · 4 files | |
| Button Groupbutton-group | adn-ui | Components | Free | 1 dep · 5 files |
