Dialog A modal dialog for confirmations, forms, and focused interactions
Open Dialog
A modal dialog component for displaying focused content that requires user interaction. Built on Radix UI Dialog for accessible keyboard navigation and focus trapping. Ideal for confirmations, settings forms, and kernel selection.
CLI Manual
npx shadcn@latest add https://nteract-elements.vercel.app/r/dialog.json Install the dependencies:
npm install radix-ui lucide-react Copy from the nteract/elements registry .
import {
Dialog,
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
} from "@/registry/primitives/dialog"
export function Example () {
return (
< Dialog >
< DialogTrigger >Open</ DialogTrigger >
< DialogContent >
< DialogHeader >
< DialogTitle >Dialog Title</ DialogTitle >
< DialogDescription >Dialog description text.</ DialogDescription >
</ DialogHeader >
< DialogFooter >
< Button >Confirm</ Button >
</ DialogFooter >
</ DialogContent >
</ Dialog >
)
}
Show Details
< Dialog >
< DialogTrigger asChild >
< Button variant = "outline" >Show Details</ Button >
</ DialogTrigger >
< DialogContent >
< DialogHeader >
< DialogTitle >Cell Details</ DialogTitle >
< DialogDescription >
Information about this cell and its execution history.
</ DialogDescription >
</ DialogHeader >
< div className = "grid gap-2 py-4" >
< div className = "flex justify-between" >
< span >Cell ID:</ span >
< span >abc-123</ span >
</ div >
</ div >
</ DialogContent >
</ Dialog >
Delete Notebook
< Dialog >
< DialogTrigger asChild >
< Button variant = "destructive" >Delete Notebook</ Button >
</ DialogTrigger >
< DialogContent >
< DialogHeader >
< DialogTitle >Delete Notebook?</ DialogTitle >
< DialogDescription >
This action cannot be undone.
</ DialogDescription >
</ DialogHeader >
< DialogFooter >
< DialogClose asChild >
< Button variant = "outline" >Cancel</ Button >
</ DialogClose >
< Button variant = "destructive" >Delete</ Button >
</ DialogFooter >
</ DialogContent >
</ Dialog >
Rename Notebook
< Dialog >
< DialogTrigger asChild >
< Button >Rename Notebook</ Button >
</ DialogTrigger >
< DialogContent >
< DialogHeader >
< DialogTitle >Rename Notebook</ DialogTitle >
< DialogDescription >
Enter a new name for your notebook.
</ DialogDescription >
</ DialogHeader >
< div className = "py-4" >
< Input placeholder = "Untitled.ipynb" />
</ div >
< DialogFooter >
< DialogClose asChild >
< Button variant = "outline" >Cancel</ Button >
</ DialogClose >
< Button >Save</ Button >
</ DialogFooter >
</ DialogContent >
</ Dialog >
Select Kernel
< Dialog >
< DialogTrigger asChild >
< Button variant = "outline" >Select Kernel</ Button >
</ DialogTrigger >
< DialogContent >
< DialogHeader >
< DialogTitle >Select Kernel</ DialogTitle >
< DialogDescription >Choose a kernel for this notebook.</ DialogDescription >
</ DialogHeader >
< div className = "grid gap-2 py-4" >
{kernels. map (( kernel ) => (
< KernelOption key = {kernel.name} kernel = {kernel} />
))}
</ div >
</ DialogContent >
</ Dialog >
Component Description DialogRoot component managing open state DialogTriggerElement that opens the dialog DialogContentModal container with overlay DialogHeaderContainer for title and description DialogFooterContainer for action buttons DialogTitleAccessible title element DialogDescriptionAccessible description element DialogCloseElement that closes the dialog DialogPortalPortal for rendering outside DOM hierarchy DialogOverlayBackground overlay
Prop Type Default Description openboolean— Controlled open state defaultOpenbooleanfalseDefault open state onOpenChange(open: boolean) => void— Callback when open state changes modalbooleantrueWhether to render as modal
Prop Type Default Description showCloseButtonbooleantrueShow the close button in top-right classNamestring— Additional CSS classes
Prop Type Default Description showCloseButtonbooleanfalseAdd a close button to footer classNamestring— Additional CSS classes
Prop Type Default Description asChildbooleanfalseRender as child element using Radix Slot