{
"$schema": "../schemas/code-crispies-module-schema.json",
"id": "html-dialog",
"title": "Native Dialog Element",
"description": "Create modal dialogs without JavaScript libraries",
"mode": "html",
"difficulty": "beginner",
"lessons": [
{
"id": "dialog-basic",
"title": "Open Dialog",
"description": "The <dialog> element creates a native modal. Add the open attribute to show it.
Use <form method=\"dialog\"> inside to close it when the form submits - no JavaScript needed!",
"task": "Create a dialog with: 1. The open attribute to show it 2. An <h2> saying 'Welcome!' 3. A <p> with a greeting message 4. A <form method=\"dialog\"> with a close button",
"previewHTML": "",
"previewBaseCSS": "body { font-family: system-ui; padding: 20px; min-height: 200px; background: #f5f5f5; } dialog { border: none; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); padding: 25px; max-width: 400px; } dialog::backdrop { background: rgba(0,0,0,0.5); } dialog h2 { margin: 0 0 15px 0; color: #1976d2; } dialog p { color: #666; margin: 0 0 20px 0; } dialog button { background: #1976d2; color: white; border: none; padding: 10px 25px; border-radius: 6px; cursor: pointer; font-size: 16px; } dialog button:hover { background: #1565c0; }",
"sandboxCSS": "",
"initialCode": "",
"solution": "",
"previewContainer": "preview-area",
"validations": [
{
"type": "element_exists",
"value": "dialog",
"message": "Add a