<mds-table> <mds-table-header> <mds-table-header-cell label="Nome"></mds-table-header-cell> <mds-table-header-cell label="Email"></mds-table-header-cell> <mds-table-header-cell label="Data"></mds-table-header-cell> </mds-table-header> <mds-table-body> <mds-table-row> <mds-table-cell><mds-text typography="detail">Mario Rossi</mds-text></mds-table-cell> <mds-table-cell><mds-text typography="detail">mario.rossi@example.com</mds-text></mds-table-cell> <mds-table-cell><mds-text typography="detail">12 ottobre 1985</mds-text></mds-table-cell> </mds-table-row> <mds-table-row> <mds-table-cell><mds-text typography="detail">Luigi Verdi</mds-text></mds-table-cell> <mds-table-cell><mds-text typography="detail">luigi.verdi@example.com</mds-text></mds-table-cell> <mds-table-cell><mds-text typography="detail">3 marzo 1993</mds-text></mds-table-cell> </mds-table-row> </mds-table-body></mds-table><mds-table-row value="42"> <mds-table-cell><mds-text typography="detail">Documento riservato.pdf</mds-text></mds-table-cell> <mds-table-cell><mds-text typography="detail">2 MB</mds-text></mds-table-cell> <mds-button slot="action" icon="mi/baseline/download" title="Scarica" variant="primary" tone="text" ></mds-button> <mds-button slot="action" icon="mi/baseline/delete" title="Elimina" variant="error" tone="text" ></mds-button></mds-table-row><mds-table selectable> <mds-table-body> <mds-table-row value="user-101"> <mds-table-cell><mds-text typography="detail">Carla Bianchi</mds-text></mds-table-cell> <mds-table-cell><mds-text typography="detail">carla.bianchi@example.com</mds-text></mds-table-cell> </mds-table-row> <mds-table-row value="user-102"> <mds-table-cell><mds-text typography="detail">Federica Neri</mds-text></mds-table-cell> <mds-table-cell><mds-text typography="detail">federica.neri@example.com</mds-text></mds-table-cell> </mds-table-row> </mds-table-body></mds-table><mds-table id="utenti" selectable> <mds-table-body> <mds-table-row value="101"> <mds-table-cell><mds-text typography="detail">Mario Rossi</mds-text></mds-table-cell> </mds-table-row> <mds-table-row value="102"> <mds-table-cell><mds-text typography="detail">Luigi Verdi</mds-text></mds-table-cell> </mds-table-row> </mds-table-body></mds-table>
<script> document.getElementById('utenti').addEventListener('mdsTableSelectionChange', (e) => { console.log('Righe selezionate:', e.detail.rows); });</script><mds-table selectable id="tabella-record"> <mds-table-body> <mds-table-row id="riga-principale" value="rec-1"> <mds-table-cell><mds-text typography="detail">Record principale</mds-text></mds-table-cell> </mds-table-row> </mds-table-body></mds-table>
<script> // Select the row programmatically (e.g. after restoring from storage) document.getElementById('riga-principale').selected = true; document.getElementById('tabella-record').updateSelection();</script><mds-table interactive> <mds-table-body> <mds-table-row value="p-01"> <mds-table-cell><mds-text typography="detail">Pratica 01</mds-text></mds-table-cell> <mds-table-cell><mds-text typography="detail">In lavorazione</mds-text></mds-table-cell> </mds-table-row> <mds-table-row value="p-02"> <mds-table-cell><mds-text typography="detail">Pratica 02</mds-text></mds-table-cell> <mds-table-cell><mds-text typography="detail">Completata</mds-text></mds-table-cell> </mds-table-row> </mds-table-body></mds-table>/* Customize hover (and selected) and sorted-row colors for a branded table */.tabella-brand mds-table-row { --mds-table-row-background-hover: rgb(var(--magma-accent-emphasis)); --mds-table-row-color-hover: rgb(var(--magma-accent-on-emphasis)); --mds-table-row-background-alt: rgb(var(--magma-surface-inverse)); --mds-table-row-color-alt: rgb(var(--magma-on-inverse)); --mds-table-row-actions-gap: calc(var(--spacing) * 200);}