import * as Dialog from '@radix-ui/react-dialog'; import { Cross2Icon } from '@radix-ui/react-icons'; import './dialog.css'; /** * Example: Basic Dialog Component * * Demonstrates: * - Compound component pattern * - Portal rendering * - Accessibility features (Title, Description) * - Custom styling with CSS */ export function BasicDialog() { return ( {/* Overlay (backdrop) */} {/* Content (modal) */} {/* Title - Required for accessibility */} Edit Profile {/* Description - Recommended for accessibility */} Make changes to your profile here. Click save when you're done. {/* Form Content */}
{/* Close button */}
); } /** * Example: Controlled Dialog * * Use when you need to: * - Sync dialog state with external state * - Programmatically open/close dialog * - Track dialog open state */ export function ControlledDialog() { const [open, setOpen] = React.useState(false); const handleSave = () => { // Your save logic here console.log('Saving...'); setOpen(false); // Close after save }; return ( Controlled Dialog This dialog's state is managed externally.

Dialog is {open ? 'open' : 'closed'}

); }