<mds-button id="btn-apri">Apri dialogo</mds-button>
<mds-modal id="dialogo"> <div class="p-400"> <mds-text>Sei sicuro di voler continuare?</mds-text> </div></mds-modal>
<script> const btn = document.getElementById('btn-apri'); const modal = document.getElementById('dialogo'); btn.addEventListener('click', () => { modal.opened = true; }); modal.addEventListener('mdsModalClose', () => { modal.opened = undefined; });</script><mds-modal id="modifica-utente" position="right"> <header slot="top" class="p-400 bg-surface-overlay shadow-ring-weak"> <mds-text typography="h5">Modifica utente</mds-text> </header>
<div class="p-400 grid gap-400"> <mds-input-field label="Nome"> <mds-input name="nome"></mds-input> </mds-input-field> <mds-input-field label="Cognome"> <mds-input name="cognome"></mds-input> </mds-input-field> </div>
<footer slot="bottom" class="p-400 flex gap-300 justify-end bg-surface-overlay shadow-ring-weak"> <mds-button variant="dark" tone="outline" id="btn-annulla">Annulla</mds-button> <mds-button variant="primary" tone="strong" id="btn-salva">Salva</mds-button> </footer></mds-modal><!-- Side panel from the right (default in most app shells) --><mds-modal id="pannello-laterale" position="right"> <div class="p-400"> <mds-text>Dettagli del documento</mds-text> </div></mds-modal>
<!-- Drawer from the bottom (mobile) --><mds-modal id="drawer-mobile" position="bottom"> <div class="p-400"> <mds-text>Azioni disponibili</mds-text> </div></mds-modal><mds-modal id="conferma-elimina" interaction="strict"> <div class="p-400 grid gap-400"> <mds-text typography="h5">Eliminare il documento?</mds-text> <mds-text>Questa operazione non e' reversibile.</mds-text> <div class="flex gap-300 justify-end"> <mds-button variant="dark" tone="outline" id="btn-no">Annulla</mds-button> <mds-button variant="error" tone="strong" id="btn-si">Elimina</mds-button> </div> </div></mds-modal>
<script> document.getElementById('btn-no').addEventListener('click', () => { document.getElementById('conferma-elimina').close(); });</script><mds-modal id="salvataggio"> <div class="p-400"> <mds-text>Salvataggio in corso...</mds-text> </div></mds-modal>
<script> async function salva() { const modal = document.getElementById('salvataggio'); modal.opened = true; await salvaRisorsa(); await modal.close(); }</script><mds-modal id="modal-focus" position="right"> <div class="p-400"> <mds-input-field label="Cerca"> <mds-input id="input-ricerca" name="ricerca"></mds-input> </mds-input-field> </div></mds-modal>
<script> const modal = document.getElementById('modal-focus'); const input = document.getElementById('input-ricerca');
modal.addEventListener('mdsModalShow', () => { input.setFocus(); }); modal.addEventListener('mdsModalHide', () => { // safe point to detach or reset content modal.opened = undefined; });</script><!-- 3D perspective tilt animation --><mds-modal id="modal-3d" animation="3d" position="center"> <div class="p-400"> <mds-text>Animazione 3D</mds-text> </div></mds-modal>
<!-- Custom animation driven by CSS vars --><mds-modal id="modal-custom" animation="custom" position="center"> <div class="p-400"> <mds-text>Animazione personalizzata</mds-text> </div></mds-modal><mds-modal id="modal-banner" animation="custom"> <mds-banner slot="window" class="max-w-md w-full mx-400" tone="box" deletable headline="Azione richiesta" > <mds-text typography="detail">Conferma la tua identita' per procedere.</mds-text> <mds-button slot="action" variant="primary" tone="text">Annulla</mds-button> <mds-button slot="action" variant="primary" tone="strong">Conferma</mds-button> </mds-banner></mds-modal><mds-modal id="pannello-info" position="right" hide-backdrop> <div class="p-400"> <mds-text>Informazioni contestuali</mds-text> </div></mds-modal>// Remove the backdrop from JavaScript (it applies from the next opening)document.getElementById('pannello-info').hideBackdrop = true;/* Rounded card-style center modal */#modal-card { --mds-modal-window-radius: var(--magma-radius-xl); --mds-modal-window-distance: calc(var(--spacing) * 600); --mds-modal-window-overflow: hidden; --mds-modal-window-background: rgb(var(--magma-surface-overlay)); --mds-modal-window-shadow: var(--shadow-2xl); --mds-modal-window-max-width: 480px;}
/* Full-width drawer */#drawer-bottom { --mds-modal-window-radius: var(--magma-radius-lg) var(--magma-radius-lg) 0 0; --mds-modal-window-max-width: 100%; --mds-modal-window-min-width: 100%;}