Modal
Overlay dialog with a blurred backdrop, header, body and footer.
modal() builds an overlay dialog: a blurred backdrop centers a 400px
rounded-20 card with an optional icon header, body and footer. It opens only
on user action — a trigger button with data-cpd-modal-trigger +
data-cpd-modal-target; Escape, the backdrop or the header close button
dismiss it.
Trigger
Section titled “Trigger”Click to open
modal({ id: 'modal-demo', title: 'Delete project', description: 'This action cannot be undone.', icon: Icon.triangleAlert(), content: '<p>Are you sure you want to delete this project?</p>', footer: button({ label: 'Cancel', variant: 'ghost' }) + button({ label: 'Delete', variant: 'solid', color: 'error' }),});| Function | Description |
|---|---|
modal({ id, title, description?, icon?, content, footer?, open?, closeLabel?, width? }) | Overlay + panel with a close button, optional header (icon circle + title + description), body and footer. |
- Trigger:
data-cpd-modal-trigger+data-cpd-modal-target="<id>"; Escape, backdrop click and the close button dismiss. - Pixel spec: backdrop
rgba(3, 6, 12, 0.6)+blur(10px), 16px padding, vertical scroll; panel max-width 400px,rounded-20(20px), white surface, medium shadow, fade + zoom-in 95%; close button 40px ghost attop-4 right-4; headerpy-4 pl-5 pr-14with a bottom hairline, 40px icon ring, 13px semibold title and 13px muted description; bodyp-5; footer hairline-toppx-5 py-4.