File manager
Folders and files in a grid or a list: pick one or many, sort, search, rename, delete and drop new files in from the computer. Write each file as an empty li.file with its details; momo.js adds the icon for its type, the size, the date and the tick box.
Files
Click to pick, -click or the tick box to pick more, Shift-click for a run. Double-click (or Enter) opens. Drag files from your computer onto it to add them. The grid / list choice is remembered.
<div class="files" id="fm-demo" data-momo-files data-menu="fm-menu" aria-label="Project files">
<div class="files-toolbar">
<nav class="breadcrumb" aria-label="Folder">
<ol><li><a href="#"><i class="mi mi-folder" aria-hidden="true"></i> Drive</a></li><li><a href="#">Projects</a></li><li aria-current="page">Website redesign</li></ol>
</nav>
<div class="files-tools">
<div class="files-search form-icon"><i class="mi mi-search" aria-hidden="true"></i><input class="form-control" type="search" placeholder="Search files" aria-label="Search files"></div>
<div class="files-views" role="group" aria-label="View">
<button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-files-view="grid" aria-label="Grid"><i class="mi mi-layout-grid" aria-hidden="true"></i></button>
<button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-files-view="list" aria-label="List"><i class="mi mi-list" aria-hidden="true"></i></button>
</div>
<label class="btn btn-sm btn-brand"><i class="mi mi-upload" aria-hidden="true"></i> Upload<input class="visually-hidden" type="file" multiple data-momo-files-upload></label>
</div>
</div>
<div class="files-selection">
<span class="files-selection-count">0 selected</span>
<button class="btn btn-sm btn-ghost" type="button" data-momo-files-action="download"><i class="mi mi-download" aria-hidden="true"></i> Download</button>
<button class="btn btn-sm btn-ghost" type="button" data-momo-files-action="star"><i class="mi mi-star" aria-hidden="true"></i> Star</button>
<button class="btn btn-sm btn-ghost" type="button" data-momo-files-action="rename"><i class="mi mi-pencil" aria-hidden="true"></i> Rename</button>
<button class="btn btn-sm btn-ghost" type="button" data-momo-files-action="delete"><i class="mi mi-trash" aria-hidden="true"></i> Delete</button>
<button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-files-action="clear" aria-label="Clear selection"><i class="mi mi-x" aria-hidden="true"></i></button>
</div>
<ul class="files-items">
<li class="file" data-kind="folder" data-name="Brand assets" data-items="24" data-modified="2026-11-18"></li>
<li class="file" data-kind="folder" data-name="Wireframes" data-items="9" data-modified="2026-11-26"></li>
<li class="file" data-name="Homepage hero.png" data-size="1840000" data-modified="2026-11-27" data-starred></li>
<li class="file" data-name="Project brief.pdf" data-size="240000" data-modified="2026-11-12"></li>
<li class="file" data-name="Content plan.docx" data-size="86000" data-modified="2026-11-24"></li>
<li class="file" data-name="Budget 2027.xlsx" data-size="54000" data-modified="2026-11-20"></li>
<li class="file" data-name="Kickoff deck.pptx" data-size="12400000" data-modified="2026-10-30"></li>
<li class="file" data-name="Product tour.mp4" data-size="482000000" data-modified="2026-11-02"></li>
<li class="file" data-name="Fonts.zip" data-size="3200000" data-modified="2026-09-14"></li>
<li class="file" data-name="tokens.css" data-size="12800" data-modified="2026-11-28"></li>
</ul>
<div class="files-foot"><span data-momo-files-count>10 items</span><span>Website redesign</span></div>
</div>
<div class="menu" id="fm-menu">
<button class="menu-item" type="button" data-momo-files-action="open"><i class="mi mi-folder-open" aria-hidden="true"></i> Open</button>
<button class="menu-item" type="button" data-momo-files-action="download"><i class="mi mi-download" aria-hidden="true"></i> Download</button>
<button class="menu-item" type="button" data-momo-files-action="rename"><i class="mi mi-pencil" aria-hidden="true"></i> Rename <kbd>F2</kbd></button>
<button class="menu-item" type="button" data-momo-files-action="star"><i class="mi mi-star" aria-hidden="true"></i> Star</button>
<div class="menu-divider"></div>
<button class="menu-item menu-item-danger" type="button" data-momo-files-action="delete"><i class="mi mi-trash" aria-hidden="true"></i> Delete <kbd>Del</kbd></button>
</div>Keyboard
| Key | Does |
|---|---|
| Arrows, Home, End | Move (in the grid, up and down go by rows) |
| Shift + arrows | Pick a run |
| + arrows, then Space | Move without picking, then add the item |
| / Esc | Pick all / pick none |
| Enter | Open |
| F2 | Rename (the name is picked without its extension) |
| Del | Delete what is picked |
| Letters | Jump to the first name that starts with them |
On touch screens a tap opens; tap the tick box to start picking, then taps add and remove.
Small and empty
Leave out what you don't need: here only the items and a list view (.files-list). An empty folder says so (change the text with data-empty), and so does a search with no matches.
<div class="card-grid">
<div class="files files-list" data-momo-files aria-label="Recent">
<ul class="files-items">
<li class="file" data-name="Invoice 1042.pdf" data-size="98000" data-modified="2026-11-29"></li>
<li class="file" data-name="Signed contract.pdf" data-size="410000" data-modified="2026-11-21"></li>
<li class="file" data-name="Logo.svg" data-size="7200" data-modified="2026-11-15"></li>
</ul>
</div>
<div class="files" data-momo-files data-empty="No files yet. Drop some here." aria-label="Uploads">
<ul class="files-items"></ul>
</div>
</div>Pictures
data-thumb shows a picture instead of the type icon.
<div class="files" data-momo-files aria-label="Photos">
<ul class="files-items">
<li class="file" data-name="Office.jpg" data-size="2100000" data-modified="2026-11-02" data-thumb="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 3'%3E%3Crect width='4' height='3' fill='%23a0e1ed'/%3E%3Ccircle cx='3' cy='1' r='.5' fill='%23fae8a4'/%3E%3Cpath d='M0 3 1.5 1.5 3 3z' fill='%2398e9ab'/%3E%3C/svg%3E"></li>
<li class="file" data-name="Team.jpg" data-size="3400000" data-modified="2026-11-04" data-thumb="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 3'%3E%3Crect width='4' height='3' fill='%23f5a8d0'/%3E%3Ccircle cx='1.3' cy='1.4' r='.6' fill='%23ae7aff'/%3E%3Ccircle cx='2.7' cy='1.4' r='.6' fill='%23f7bd8f'/%3E%3C/svg%3E"></li>
<li class="file" data-name="Launch.jpg" data-size="1900000" data-modified="2026-11-09" data-thumb="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 3'%3E%3Crect width='4' height='3' fill='%23a9baf8'/%3E%3Cpath d='M2 .4 2.6 2.2H1.4z' fill='%23fae8a4'/%3E%3C/svg%3E"></li>
</ul>
</div>Storage
A meter for a sidebar or a settings page, built from progress.
<div class="files-storage">
<div class="files-storage-text"><span><b>7.4 GB</b> of 15 GB used</span><span>49%</span></div>
<progress class="progress progress-sm" value="49" max="100">49%</progress>
</div>File types
The icon and its color come from the extension: folders yellow, images pink, PDF red, documents blue, spreadsheets green, slides orange, video violet, audio lime, code cyan, archives and everything else gray. Your own icon: write the inside of the li yourself with a .file-icon.file-<color>, a .file-name and a .file-meta.
JavaScript
Every action fires an event first; call preventDefault() to handle it yourself (ask before deleting, save a rename on the server, upload the files).
const drive = document.querySelector('#fm-demo');
drive.addEventListener('momo:open', (e) => openFile(e.detail.item));
drive.addEventListener('momo:delete', (e) => { if (!confirm(`Delete ${e.detail.items.length} items?`)) e.preventDefault(); });
drive.addEventListener('momo:rename', (e) => save(e.detail.from, e.detail.to));
drive.addEventListener('momo:upload', (e) => { e.preventDefault(); upload(e.detail.files); });
drive.addEventListener('momo:action', (e) => console.log(e.detail.action, e.detail.items)); // download, star, your own
Momo.files.add(drive, { name: 'Notes.txt', size: 1200, modified: '2026-11-30' });
Momo.files.selected(drive); // ['Project brief.pdf']
Momo.files.size(482000000); // '482 MB'
Accessibility
- The items are one list box you can pick many from: Tab into it once, then use the keys above. Each item reads its name, type, size and date.
- How many are picked, deletes, renames and uploads are read out.
- Every action also has a button (the selection bar or the menu), so nothing needs dragging.