import{_ as i,o as a,c as t,ae as n}from"./chunks/framework.C8AWLET_.js";const o=JSON.parse('{"title":"Modal & Drawer Components","description":"","frontmatter":{},"headers":[],"relativePath":"ui/modal.md","filePath":"ui/modal.md"}'),h={name:"ui/modal.md"};function l(e,s,k,p,d,r){return a(),t("div",null,[...s[0]||(s[0]=[n(`
Overlay components for dialogs, side panels, and popups with reactive control.
_modal) A dialog component that appears on top of the page. The modal is completely removed from the DOM when closed, optimizing performance.
const $open = $(false)
_button({ onclick: () => $open(true) }, 'Open Modal')
_modal({ $open: $open, title: 'Welcome' }, [
$.html('p', {}, 'This is a simple modal dialog.'),
_button({ onclick: () => $open(false) }, 'Close')
])const $open = $(false)
const $result = $(null)
_modal({ $open: $open, title: 'Confirm Delete' }, [
$.html('p', {}, 'Are you sure you want to delete this item?'),
_button({ class: 'btn-error', onclick: () => {
$result('Item deleted')
$open(false)
} }, 'Delete')
])_drawer) A sidebar panel that slides in from the side.
const $open = $(false)
_drawer({
id: 'my-drawer',
$open: $open,
content: $.html('div', {}, 'Main content'),
side: $.html('div', { class: 'p-4' }, [
$.html('h3', {}, 'Menu'),
$.html('ul', { class: 'menu' }, [
$.html('li', {}, [$.html('a', { onclick: () => $open(false) }, 'Close')])
])
])
})_modal | Prop | Type | Description |
|---|---|---|
$open | Signal<boolean> | Controls modal visibility |
title | string | Modal title text |
_drawer | Prop | Type | Description |
|---|---|---|
id | string | Unique identifier for the drawer |
$open | Signal<boolean> | Controls drawer visibility |
content | HTMLElement | Main content area |
side | HTMLElement | Sidebar content |