@@ -50,75 +50,40 @@ toc:
{% endcall %}
{% endset %}
-{% set code_script %}
-
-{% endset %}
-
-{{ code_preview("dialog", code_script | prettyHtml ~ code_html | prettyHtml) }}
+{{ code_preview("dialog", code_html | prettyHtml) }}
-
-
-
- {% lucide "circle-alert" %}
-
This component requires Javascript.
-
+
- The component is structured as such:
-
- - A
<div class="dialog"> which wraps around the entire component and holds it state (e.g. open/close).
- - A
<button> that acts as the trigger to open or close the popover.
- - A
<div role="dialog"> that holds the dialog itself. It also acts as the backdrop for the dialog.
- - Inside of it, we have:
-
- - A
<header> that contains the title (<h2>) and description (<p>) of the dialog.
- - A
<section> for the content.
- - A
<footer> that usually contains actions.
- - A close
<button>.
-
-
-
- You can include the Javascript code provided below, load it as an individual file or use the CLI. Some Alpine.js properties are also required on certain elements (e.g. x-bind, x-data, @click).
+ The component has the following structure:
+
+ <dialog class="dialog">
+ - Wraps around the entire component and acts as its backdrop.
+
+ <header>
+ - Contains the header for the dialog:
+
+ <h2>
+ - The title of the dialog.
+ <p> Optional
+ - The description of the dialog.
+
+
+ <section> Optional
+ - For the content.
+ <footer> Optional
+ - Usually contains actions.
+ <form method="dialog"> Optional
+ - A form that contains a single button to close the dialog.
+
+
+
+ The example below also include a <button type="button> to show how we can open the dialog using the showModal() method as well as aria-related attributes recommended for accessiblity:
.
-
-
-{% from "tabs.njk" import tabs %}
-{% set tabsets = [
- { tab: "HTML", panel: code_block(code_html | prettyHtml, class="") },
- { tab: "Javascipt (Alpine.js)", panel: code_block(code_script | prettyHtml, class="") }
-] %}
-{{ tabs(id="combobox", tabsets=tabsets) }}
-
-
- The component will dispatch dialog:opened and dialog:closed events when the dialog is opened or closed. You can also dispatch dialog:open and dialog:close events to open or close the dialog programmatically. You will need the element to have an id to be able to target it (e.g. <div id="my-dialog" class="dialog">):
-
-
-{% set code_dispatch %}
{% endset %}
-{{ code_block(code_dispatch | prettyHtml, "html") }}
+{{ code_block(code_html | prettyHtml, class="") }}
@@ -141,20 +106,19 @@ document.addEventListener('alpine:init', () => {
-{% set raw_code %}{% raw %}{% set footer %}
-