Asset List¶
Rows for uploaded files, with a thumbnail, a name and reference, and action buttons.
Decision¶
| When | Use |
|---|---|
| Listing files a plugin stores, with a way to copy or remove each | Asset List |
| Choosing files to upload | File Picker |
Usage¶
<div class="stolon-asset-list">
<div class="stolon-asset-item">
<img class="stolon-asset-thumb" src="logo.png" alt="">
<div class="stolon-asset-info">
<div class="stolon-asset-name">logo.png</div>
<div class="stolon-asset-ref">asset://logo</div>
</div>
<div class="stolon-asset-actions">
<button type="button" class="stolon-row-btn" title="Copy" aria-label="Copy"><span class="material-icons" aria-hidden="true">content_copy</span></button>
<button type="button" class="stolon-row-btn stolon-destructive" title="Delete" aria-label="Delete"><span class="material-icons" aria-hidden="true">delete</span></button>
</div>
</div>
</div>
Classes: stolon-asset-list, stolon-asset-item, stolon-asset-thumb, stolon-asset-info, stolon-asset-name, stolon-asset-ref, stolon-asset-actions. Its buttons are Row Buttons, stolon-row-btn.
States and Modifiers¶
destructiveon astolon-row-btnturns its hover red, for a button that deletes the file.- The thumbnail is contained on a checkerboard of the surface and a wash of the text color, so it follows the theme.
Gotchas¶
- There is no JavaScript. Give each row button a
titleand anaria-label.
Reference¶
Generated from the code by scripts/build-docs.mjs. Edit the code, not this section.
| Class | What it looks like |
|---|---|
stolon-asset-list |
Vertical list of uploaded asset rows |
stolon-asset-item |
One asset row with thumbnail, info, and actions |
stolon-asset-thumb |
Square checkerboard thumbnail so transparent images stay visible |
stolon-asset-info |
Column holding the asset name and its reference |
stolon-asset-name |
Bold asset name that clips with an ellipsis |
stolon-asset-ref |
Small dimmed mono reference that breaks anywhere |
stolon-asset-actions |
Row of action buttons at the end of an asset row |
Example¶
Example Code¶
<!-- title: Asset List -->
<div id="mount"></div>
<script type="module">
await window.__baseReady;
const { rect } = window.__gallery;
const { COLORS } = window.__galleryData;
const names = ['logo.png', 'a-very-long-asset-file-name-that-clips-with-an-ellipsis.svg'];
document.getElementById('mount').innerHTML = '<div class="stolon-asset-list">' + names.map((name, i) =>
'<div class="stolon-asset-item">' +
'<img class="stolon-asset-thumb" alt="" src="' + rect(48, 48, COLORS[i], 'A') + '">' +
'<div class="stolon-asset-info"><div class="stolon-asset-name">' + name + '</div><div class="stolon-asset-ref">assets/' + name + '</div></div>' +
'<div class="stolon-asset-actions">' +
'<button type="button" class="stolon-row-btn" title="Copy" aria-label="Copy"><span class="material-icons" aria-hidden="true">content_copy</span></button>' +
'<button type="button" class="stolon-row-btn stolon-destructive" title="Delete" aria-label="Delete"><span class="material-icons" aria-hidden="true">delete</span></button>' +
'</div>' +
'</div>').join('') + '</div>';
</script>