# #129 — Cascading Miller Columns Browser

> Multi-column cascading hierarchy browser with live file preview, keyboard arrow navigation, and mobile single-column drill-down.

## Metadata

- **Index**: #129
- **Slug**: `miller-columns-browser`
- **Kind**: `ui`
- **Family**: Hierarchy & Files
- **Theme**: `light`
- **Mobile Strength**: `native-first`
- **Tags**: `miller-columns`, `file-browser`, `hierarchy`, `breadcrumbs`, `keyboard-nav`, `preview-pane`
- **Best For**: Cloud storage and SFTP/asset managers, Deep category taxonomy and CMS browsers, Code repository and deployment explorers, Design system token tree inspectors
- **Real-World Inspiration**: [ForkLift](https://binarynights.com/)
- **Detail Page**: https://templates.michaelpitts.net/t/miller-columns-browser
- **Live Demo**: https://templates.michaelpitts.net/demos/miller-columns-browser.html
- **JSON API**: https://templates.michaelpitts.net/api/templates/miller-columns-browser

## Why This Aesthetic Is Unique

Reveals ancestor context and leaf metadata simultaneously without expanding messy accordion trees, then collapses gracefully into a single-column breadcrumb navigator on phones.

## Color Palette

| Role | Name | Hex |
|------|------|-----|
| `canvas` | Ice Slate | `#F4F6F9` |
| `surface` | Crisp White | `#FFFFFF` |
| `ink` | Deep Navy | `#162032` |
| `accent` | Transmit Blue | `#0B74DE` |
| `muted` | Steel Gray | `#627086` |

## Typography

- **Display**: `Inter`
- **Body**: `Inter`
- **Mono**: `JetBrains Mono`
- **Scale Notes**: 13.5px file rows with 44px touch height, 11px uppercase mono column headers, 12px mono code preview snippets.
- **Google Fonts**: https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&family=JetBrains+Mono:wght@500;600&display=swap
  ```html
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&family=JetBrains+Mono:wght@500;600&display=swap">
  ```

## Layout Architecture

Horizontally flowing 250px fixed columns + fluid metadata preview card on desktop; single active column or preview card with breadcrumb jump bar on <=780px.

## Interaction & Micro-Motion Rules

Clicking any folder appends its child column and auto-scrolls right; clicking a file opens its metadata & snippet card; ArrowUp/Down/Left/Right navigate the entire tree.

## Mobile & Responsive Rules

Displays only the deepest active column or file preview at 100% width with a dedicated 'Up One Level' bar and horizontally scrollable clickable breadcrumbs.

## Agent Guardrails

### DO
- Auto-scroll the Miller column strip to the rightmost newly opened column on desktop.
- Show a clickable breadcrumb trail so users can jump back multiple levels in one tap.
- Switch to single-column drill-down below 780px to prevent awkward nested horizontal scrolls.

### DON'T
- Never truncate file names without showing the full path in the preview or status bar.
- Avoid mixing inline tree-expansion chevrons with Miller columns in the same pane.

## Complete Standalone Starter Code

File: `demos/miller-columns-browser.html`

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cascading Miller Columns Hierarchy Browser — Panic Transmit-Inspired</title>
<style>
  :root {
    --canvas: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #edf1f7;
    --border: #dce2ec;
    --ink: #162032;
    --muted: #627086;
    --accent: #0b74de;
    --accent-soft: rgba(11,116,222,0.12);
    --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, monospace;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; background: var(--canvas); color: var(--ink); font-family: var(--font); overflow-x: hidden; }
  .app { display: flex; flex-direction: column; height: 100vh; min-height: 540px; }
  .toolbar {
    min-height: 54px;
    padding: 8px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }
  .crumb-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 100%;
  }
  .crumb-bar::-webkit-scrollbar { display: none; }
  .crumb {
    min-height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--muted);
    font: 600 13px var(--font);
    cursor: pointer;
    white-space: nowrap;
  }
  .crumb:last-child { color: var(--ink); background: var(--surface-2); }
  .crumb:hover { background: var(--surface-2); color: var(--accent); }
  .sep { color: #a0aec0; font-size: 12px; }
  .search-input {
    min-height: 38px;
    width: 220px;
    max-width: 100%;
    padding: 0 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--canvas);
    color: var(--ink);
    font: 13px var(--font);
  }
  .columns-wrap {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--surface);
  }
  .column {
    width: 250px;
    min-width: 250px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--surface);
  }
  .col-head {
    padding: 10px 12px;
    font: 700 11px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--canvas);
  }
  .col-list { flex: 1; overflow-y: auto; padding: 6px; }
  .row-btn {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--ink);
    font: 500 13.5px var(--font);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    text-align: left;
  }
  .row-btn:hover { background: var(--surface-2); }
  .row-btn.active { background: var(--accent); color: #fff; }
  .row-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .row-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chev { opacity: 0.65; font-size: 12px; flex-shrink: 0; }

  .preview-col {
    flex: 1;
    min-width: 280px;
    padding: 22px;
    overflow-y: auto;
    background: var(--canvas);
  }
  .preview-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    max-width: 460px;
  }
  .file-glyph {
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    font-size: 26px;
    margin-bottom: 14px;
  }
  .file-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; word-break: break-word; }
  .file-path { font: 12px var(--mono); color: var(--muted); margin-bottom: 16px; word-break: break-all; }
  .meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .meta-box { background: var(--canvas); border-radius: 9px; padding: 10px; border: 1px solid var(--border); }
  .meta-k { font: 600 10px var(--mono); text-transform: uppercase; color: var(--muted); }
  .meta-v { font: 600 13px var(--mono); margin-top: 3px; }
  .code-snip {
    background: #141b29; color: #dbe7ff;
    padding: 12px; border-radius: 10px;
    font: 12px/1.55 var(--mono);
    overflow-x: auto;
    white-space: pre;
  }
  .mobile-nav {
    display: none;
    padding: 8px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .back-btn {
    min-height: 40px; padding: 0 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--ink); font: 600 13px var(--font); cursor: pointer;
  }
  .statusbar {
    padding: 8px 14px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    font: 500 12px var(--mono);
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 10px;
  }
  @media (max-width: 780px) {
    .mobile-nav { display: flex; }
    .search-input { width: 100%; }
    .columns-wrap { display: block; overflow-x: hidden; overflow-y: auto; }
    .column, .preview-col { width: 100%; min-width: 100%; border-right: none; display: none; }
    .column.mobile-active, .preview-col.mobile-active { display: flex; flex-direction: column; }
    .preview-col { padding: 14px; }
  }
</style>
</head>
<body>
<div class="app">
  <header class="toolbar">
    <nav class="crumb-bar" id="crumbBar" aria-label="Breadcrumb"></nav>
    <input class="search-input" id="filterInput" type="search" placeholder="Filter current level...">
  </header>

  <div class="mobile-nav" id="mobileNav">
    <button class="back-btn" id="mobileBackBtn" type="button">← Up One Level</button>
    <span style="font:600 12px var(--mono);color:var(--muted);" id="mobileDepthLabel">Level 1</span>
  </div>

  <main class="columns-wrap" id="columnsWrap" aria-label="Miller columns file browser"></main>

  <footer class="statusbar">
    <span id="statusPath">/edge-cluster</span>
    <span>Arrow keys ↑↓←→ navigate · Enter selects</span>
  </footer>
</div>

<script>
const TREE = {
  name: 'edge-cluster',
  type: 'dir',
  children: [
    {
      name: 'services', type: 'dir', children: [
        {
          name: 'api-gateway', type: 'dir', children: [
            { name: 'routes.ts', type: 'file', size: '14.2 KB', perms: '-rw-r--r--', updated: '2m ago', snippet: 'export const routes = [\n  { path: "/v2/health", cache: "no-store" },\n  { path: "/v2/catalog", cache: "s-maxage=60" }\n];' },
            { name: 'rate-limit.ts', type: 'file', size: '6.8 KB', perms: '-rw-r--r--', updated: '1h ago', snippet: 'const bucket = new TokenBucket({ capacity: 120, refillPerSec: 15 });\nexport function allow(ip: string) { return bucket.take(ip); }' },
            { name: 'tls.conf', type: 'file', size: '2.1 KB', perms: '-rw-------', updated: '3d ago', snippet: 'protocols TLSv1.3;\nprefer_server_ciphers on;\nocsp_stapling on;' }
          ]
        },
        {
          name: 'image-proxy', type: 'dir', children: [
            { name: 'webp-encoder.rs', type: 'file', size: '19.4 KB', perms: '-rw-r--r--', updated: '4h ago', snippet: 'pub fn encode_webp(pixels: &[u8], q: f32) -> Vec<u8> {\n  webp::Encoder::from_rgba(pixels, 1280, 800).encode(q).to_vec()\n}' },
            { name: 'cache-keys.json', type: 'file', size: '3.3 KB', perms: '-rw-r--r--', updated: 'Yesterday', snippet: '{\n  "ttlSeconds": 86400,\n  "vary": ["Accept", "DPR"]\n}' }
          ]
        }
      ]
    },
    {
      name: 'deployments', type: 'dir', children: [
        {
          name: 'us-east-1', type: 'dir', children: [
            { name: 'release-2.14.yaml', type: 'file', size: '4.9 KB', perms: '-rw-r--r--', updated: '18m ago', snippet: 'apiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: catalog-web\nspec:\n  replicas: 4' },
            { name: 'rollout.log', type: 'file', size: '82.1 KB', perms: '-rw-r--r--', updated: '15m ago', snippet: '[05:14:02] healthcheck 200 OK (4/4 pods ready)\n[05:14:05] traffic shifted 100% -> v2.14' }
          ]
        },
        {
          name: 'eu-central-1', type: 'dir', children: [
            { name: 'release-2.14.yaml', type: 'file', size: '4.9 KB', perms: '-rw-r--r--', updated: '22m ago', snippet: 'region: eu-central-1\nreplicas: 3\nzeroDowntime: true' }
          ]
        }
      ]
    },
    {
      name: 'assets', type: 'dir', children: [
        { name: 'brand-mark.svg', type: 'file', size: '1.8 KB', perms: '-rw-r--r--', updated: '6d ago', snippet: '<svg viewBox="0 0 32 32">\n  <rect rx="8" width="32" height="32" fill="#0b74de"/>\n</svg>' },
        { name: 'tokens.css', type: 'file', size: '5.4 KB', perms: '-rw-r--r--', updated: '2d ago', snippet: ':root {\n  --surface: #ffffff;\n  --accent: #0b74de;\n}' }
      ]
    },
    { name: 'README.md', type: 'file', size: '3.1 KB', perms: '-rw-r--r--', updated: '5d ago', snippet: '# Edge Cluster Manifests\nManaged via declarative Miller-column browser.\nAll deploys require verified health checks.' }
  ]
};

let path = ['services', 'api-gateway', 'routes.ts'];
const columnsWrap = document.getElementById('columnsWrap');
const crumbBar = document.getElementById('crumbBar');
const filterInput = document.getElementById('filterInput');
const statusPath = document.getElementById('statusPath');
const mobileBackBtn = document.getElementById('mobileBackBtn');
const mobileDepthLabel = document.getElementById('mobileDepthLabel');

function getNodesAlongPath() {
  const levels = [TREE];
  let cur = TREE;
  for (const seg of path) {
    const next = (cur.children || []).find(c => c.name === seg);
    if (!next) break;
    levels.push(next);
    cur = next;
  }
  return levels;
}

function render() {
  const levels = getNodesAlongPath();
  const q = filterInput.value.trim().toLowerCase();

  // Breadcrumbs
  crumbBar.innerHTML = levels.map((node, idx) => `
    ${idx > 0 ? '<span class="sep">/</span>' : ''}
    <button type="button" class="crumb" data-depth="${idx}">${node.name}</button>
  `).join('');
  crumbBar.querySelectorAll('.crumb').forEach(btn => {
    btn.addEventListener('click', () => {
      const d = Number(btn.dataset.depth);
      path = path.slice(0, d);
      filterInput.value = '';
      render();
    });
  });

  statusPath.textContent = '/' + levels.map(n => n.name).join('/');
  mobileDepthLabel.textContent = `Depth ${levels.length - 1} · ${levels[levels.length - 1].name}`;
  mobileBackBtn.disabled = path.length === 0;
  mobileBackBtn.style.opacity = path.length === 0 ? '0.45' : '1';

  columnsWrap.innerHTML = '';

  // Render directory columns
  const dirLevels = levels.filter(n => n.type === 'dir');
  const lastNode = levels[levels.length - 1];
  const showingPreview = lastNode.type === 'file';

  dirLevels.forEach((dirNode, colIdx) => {
    const col = document.createElement('section');
    col.className = 'column';
    if (!showingPreview && colIdx === dirLevels.length - 1) col.classList.add('mobile-active');
    const selectedName = path[colIdx];
    const items = (dirNode.children || []).filter(item => {
      if (!q || colIdx !== dirLevels.length - 1) return true;
      return item.name.toLowerCase().includes(q);
    });
    col.innerHTML = `<div class="col-head">${dirNode.name} (${items.length})</div><div class="col-list"></div>`;
    const list = col.querySelector('.col-list');
    items.forEach(item => {
      const btn = document.createElement('button');
      btn.type = 'button';
      btn.className = 'row-btn' + (item.name === selectedName ? ' active' : '');
      btn.innerHTML = `
        <span class="row-left">
          <span>${item.type === 'dir' ? '📁' : '📄'}</span>
          <span class="row-name">${item.name}</span>
        </span>
        <span class="chev">${item.type === 'dir' ? '›' : item.size || ''}</span>
      `;
      btn.addEventListener('click', () => {
        path = path.slice(0, colIdx).concat(item.name);
        filterInput.value = '';
        render();
      });
      list.appendChild(btn);
    });
    columnsWrap.appendChild(col);
  });

  if (showingPreview) {
    const prev = document.createElement('aside');
    prev.className = 'preview-col mobile-active';
    prev.innerHTML = `
      <div class="preview-card">
        <div class="file-glyph">📄</div>
        <div class="file-title">${lastNode.name}</div>
        <div class="file-path">/${levels.map(n => n.name).join('/')}</div>
        <div class="meta-grid">
          <div class="meta-box"><div class="meta-k">Size</div><div class="meta-v">${lastNode.size}</div></div>
          <div class="meta-box"><div class="meta-k">Updated</div><div class="meta-v">${lastNode.updated}</div></div>
          <div class="meta-box"><div class="meta-k">Permissions</div><div class="meta-v">${lastNode.perms}</div></div>
          <div class="meta-box"><div class="meta-k">Type</div><div class="meta-v">${lastNode.name.split('.').pop().toUpperCase()}</div></div>
        </div>
        <div class="code-snip">${lastNode.snippet.replace(/</g, '&lt;')}</div>
      </div>
    `;
    columnsWrap.appendChild(prev);
  }

  columnsWrap.scrollLeft = columnsWrap.scrollWidth;
}

mobileBackBtn.addEventListener('click', () => {
  if (path.length > 0) { path.pop(); render(); }
});
filterInput.addEventListener('input', render);

window.addEventListener('keydown', e => {
  if (document.activeElement === filterInput) return;
  const levels = getNodesAlongPath();
  const activeDir = levels[levels.length - 1].type === 'dir' ? levels[levels.length - 1] : levels[levels.length - 2];
  const colIdx = levels[levels.length - 1].type === 'dir' ? levels.length - 1 : levels.length - 2;
  const items = activeDir.children || [];
  const curName = path[colIdx];
  const idx = items.findIndex(i => i.name === curName);

  if (e.key === 'ArrowDown' && items.length) {
    e.preventDefault();
    const next = items[(idx + 1) % items.length];
    path = path.slice(0, colIdx).concat(next.name);
    render();
  } else if (e.key === 'ArrowUp' && items.length) {
    e.preventDefault();
    const prev = items[(idx - 1 + items.length) % items.length];
    path = path.slice(0, colIdx).concat(prev.name);
    render();
  } else if (e.key === 'ArrowLeft' && path.length > 0) {
    e.preventDefault();
    path.pop();
    render();
  } else if (e.key === 'ArrowRight') {
    const last = levels[levels.length - 1];
    if (last.type === 'dir' && last.children?.length) {
      e.preventDefault();
      path.push(last.children[0].name);
      render();
    }
  }
});

render();
</script>
</body>
</html>
```
