Questa pagina è generata dai pacchetti Magma, documentati solo in inglese.
<!-- INCORRECT - expecting the component to handle the download itself --><mds-file filename="report.pdf" href="/files/report.pdf"></mds-file>
<!-- CORRECT - consumer listens to the event and handles the download --><mds-file filename="report.pdf" id="card-report"></mds-file>
<script> document.getElementById('card-report').addEventListener('mdsFileDownload', (e) => { window.location.href = '/files/' + e.detail.filename; });</script><!-- INCORRECT --><mds-file filename="archivio" format="document"></mds-file>
<!-- CORRECT - use suffix to override file-type detection --><mds-file filename="archivio" suffix="pdf"></mds-file>/* INCORRECT */mds-file >>> .preview { background-color: blue;}
/* CORRECT */mds-file { --mds-file-preview-icon-background: rgb(var(--magma-accent-surface-subtle)); --mds-file-preview-icon-color: rgb(var(--magma-accent-fg));}<!-- INCORRECT --><a href="/download/report.pdf"> <mds-file filename="report.pdf"></mds-file></a>
<!-- CORRECT - use the mdsFileDownload event to trigger navigation or download --><mds-file filename="report.pdf" id="file-report"></mds-file>
<script> document.getElementById('file-report').addEventListener('mdsFileDownload', () => { window.location.href = '/download/report.pdf'; });</script><!-- INCORRECT --><div class="file-row" onclick="download('report.pdf')"> <img src="pdf-icon.svg" alt="PDF" /> <span>report.pdf</span></div>
<!-- CORRECT --><mds-file filename="report.pdf"></mds-file>