# Modal Dialog **Task:** "Add a modal dialog for the delete confirmation." ## Without Ponytail ```bash npm install @radix-ui/react-dialog # or: npm install react-modal ``` ```jsx import * as Dialog from "@radix-ui/react-dialog"; import { useState } from "react"; export function DeleteModal({ onConfirm, onCancel }) { return ( Confirm deletion This action cannot be undone.
); } ``` A dependency, a portal, an overlay, a root, a trigger, a content wrapper — to show a box with two buttons. ## With Ponytail ```html

This action cannot be undone.

``` ```js const dialog = document.getElementById("confirm-delete"); document.getElementById("cancel").onclick = () => dialog.close(); document.getElementById("confirm").onclick = () => { onConfirm(); dialog.close(); }; // Open it: dialog.showModal(); ``` **1 dependency + 30 lines → 0 dependencies + 8 lines.** The native `` traps focus automatically, closes on Escape, renders a backdrop via `::backdrop`, and is accessible by default. All browsers since 2022. The library was solving a problem the platform solved.