Snippets Collapsible

Bootstrap 5 Expandable Row Table

A clean orders table where each row expands to reveal product, quantity and shipping details, with an expand-all control.

Bootstrap 5 No jQuery Jun 2020 16.6K views

<section class="orders-section wdw-stage">
  <div class="container">
    <div class="card wdw-card border-0 overflow-hidden orders-card">
      <div class="card-header bg-body border-0 p-4 pb-3">
        <div class="d-flex flex-wrap align-items-center justify-content-between gap-3">
          <div>
            <h2 class="h4 wdw-heading mb-1">Recent orders</h2>
            <p class="text-body-secondary small mb-0">Select a row to see line items and shipping details.</p>
          </div>
          <dl class="stat-strip d-flex mb-0 rounded-4 bg-body-tertiary">
            <div class="stat px-4 py-2"><dt class="small text-body-secondary fw-medium">Orders</dt><dd class="fs-3 fw-bold mb-0 lh-1 text-body-emphasis">4</dd></div>
            <div class="stat px-4 py-2"><dt class="small text-body-secondary fw-medium">Revenue</dt><dd class="fs-3 fw-bold mb-0 lh-1 text-body-emphasis">$13.7k</dd></div>
            <div class="stat px-4 py-2"><dt class="small text-body-secondary fw-medium">Fulfilled</dt><dd class="fs-3 fw-bold mb-0 lh-1 text-body-emphasis">50%</dd></div>
          </dl>
        </div>
        <div class="d-flex align-items-center justify-content-between gap-3 mt-4 toolbar">
          <ul class="nav nav-pills gap-1 flex-nowrap order-filters" aria-label="Filter orders by status">
            <li class="nav-item"><button type="button" class="nav-link active rounded-pill px-3 text-nowrap" data-filter="all">All</button></li>
            <li class="nav-item"><button type="button" class="nav-link rounded-pill px-3 text-nowrap" data-filter="fulfilled">Fulfilled</button></li>
            <li class="nav-item"><button type="button" class="nav-link rounded-pill px-3 text-nowrap" data-filter="placed">Placed</button></li>
            <li class="nav-item"><button type="button" class="nav-link rounded-pill px-3 text-nowrap" data-filter="delivered">Delivered</button></li>
          </ul>
          <button type="button" class="btn btn-outline-primary rounded-pill px-4 text-nowrap flex-none" id="expandAllOrders">Expand all</button>
        </div>
      </div>
      <div class="table-responsive">
        <table class="table table-hover align-middle mb-0 orders-table">
          <thead>
            <tr class="text-body-secondary text-uppercase">
              <th scope="col" class="ps-4 text-nowrap">Order</th>
              <th scope="col" class="d-none d-sm-table-cell">Customer</th>
              <th scope="col" class="d-none d-md-table-cell">Status</th>
              <th scope="col" class="text-end pe-4">Total</th>
              <th scope="col" class="d-none d-lg-table-cell ps-4">Created</th>
              <th scope="col" class="pe-4"><span class="visually-hidden">Toggle details</span></th>
            </tr>
          </thead>
          <tbody>
            <tr class="order-row" data-status="fulfilled">
              <td class="ps-4 text-nowrap"><span class="fw-semibold">#SO-13487</span><span class="d-block d-sm-none small text-body-secondary">Gasper Antunes</span><span class="d-md-none small text-body-secondary d-flex align-items-center gap-1 mt-1"><span class="status-dot bg-success" aria-hidden="true"></span>Fulfilled</span></td>
              <td class="d-none d-sm-table-cell"><div class="d-flex align-items-center gap-2"><span class="avatar-initials bg-success-subtle text-success-emphasis" aria-hidden="true">GA</span><span class="fw-medium">Gasper Antunes</span></div></td>
              <td class="d-none d-md-table-cell"><span class="badge rounded-pill status-badge bg-success-subtle text-success-emphasis"><span class="status-dot bg-success" aria-hidden="true"></span>Fulfilled</span></td>
              <td class="text-end pe-4 fw-semibold">$2,674.00</td>
              <td class="d-none d-lg-table-cell ps-4 text-body-secondary">Today</td>
              <td class="pe-4 text-end">
                <button type="button" class="btn btn-sm border rounded-circle toggle-btn bg-body-tertiary text-body-emphasis" aria-expanded="false" aria-controls="order-1" aria-label="Show details for order SO-13487"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6l4 4 4-4"/></svg></button>
              </td>
            </tr>
            <tr class="detail-row"><td colspan="6" class="p-0 border-0">
              <div class="collapse" id="order-1"><div class="detail-box mx-4 mb-3 p-3 rounded-3 bg-body-tertiary"><div class="row g-3 small">
                <div class="col-sm-5"><div class="text-body-secondary">Product</div><div class="fw-medium">iPhone 15 Pro, 256 GB</div></div>
                <div class="col-sm-3"><div class="text-body-secondary">Quantity</div><div class="fw-medium">2</div></div>
                <div class="col-sm-4"><div class="text-body-secondary">Ships to</div><div class="fw-medium">Lisbon, Portugal</div></div>
              </div></div></div>
            </td></tr>
            <tr class="order-row" data-status="fulfilled">
              <td class="ps-4 text-nowrap"><span class="fw-semibold">#SO-13488</span><span class="d-block d-sm-none small text-body-secondary">Tinder Steel</span><span class="d-md-none small text-body-secondary d-flex align-items-center gap-1 mt-1"><span class="status-dot bg-success" aria-hidden="true"></span>Fulfilled</span></td>
              <td class="d-none d-sm-table-cell"><div class="d-flex align-items-center gap-2"><span class="avatar-initials bg-success-subtle text-success-emphasis" aria-hidden="true">TS</span><span class="fw-medium">Tinder Steel</span></div></td>
              <td class="d-none d-md-table-cell"><span class="badge rounded-pill status-badge bg-success-subtle text-success-emphasis"><span class="status-dot bg-success" aria-hidden="true"></span>Fulfilled</span></td>
              <td class="text-end pe-4 fw-semibold">$3,664.00</td>
              <td class="d-none d-lg-table-cell ps-4 text-body-secondary">Yesterday</td>
              <td class="pe-4 text-end">
                <button type="button" class="btn btn-sm border rounded-circle toggle-btn bg-body-tertiary text-body-emphasis" aria-expanded="false" aria-controls="order-2" aria-label="Show details for order SO-13488"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6l4 4 4-4"/></svg></button>
              </td>
            </tr>
            <tr class="detail-row"><td colspan="6" class="p-0 border-0">
              <div class="collapse" id="order-2"><div class="detail-box mx-4 mb-3 p-3 rounded-3 bg-body-tertiary"><div class="row g-3 small">
                <div class="col-sm-5"><div class="text-body-secondary">Product</div><div class="fw-medium">MacBook Air 13", M3</div></div>
                <div class="col-sm-3"><div class="text-body-secondary">Quantity</div><div class="fw-medium">3</div></div>
                <div class="col-sm-4"><div class="text-body-secondary">Ships to</div><div class="fw-medium">Berlin, Germany</div></div>
              </div></div></div>
            </td></tr>
            <tr class="order-row" data-status="placed">
              <td class="ps-4 text-nowrap"><span class="fw-semibold">#SO-13489</span><span class="d-block d-sm-none small text-body-secondary">Micro Steel</span><span class="d-md-none small text-body-secondary d-flex align-items-center gap-1 mt-1"><span class="status-dot bg-warning" aria-hidden="true"></span>Placed</span></td>
              <td class="d-none d-sm-table-cell"><div class="d-flex align-items-center gap-2"><span class="avatar-initials bg-warning-subtle text-warning-emphasis" aria-hidden="true">MS</span><span class="fw-medium">Micro Steel</span></div></td>
              <td class="d-none d-md-table-cell"><span class="badge rounded-pill status-badge bg-warning-subtle text-warning-emphasis"><span class="status-dot bg-warning" aria-hidden="true"></span>Placed</span></td>
              <td class="text-end pe-4 fw-semibold">$2,674.00</td>
              <td class="d-none d-lg-table-cell ps-4 text-body-secondary">March 20, 2026</td>
              <td class="pe-4 text-end">
                <button type="button" class="btn btn-sm border rounded-circle toggle-btn bg-body-tertiary text-body-emphasis" aria-expanded="false" aria-controls="order-3" aria-label="Show details for order SO-13489"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6l4 4 4-4"/></svg></button>
              </td>
            </tr>
            <tr class="detail-row"><td colspan="6" class="p-0 border-0">
              <div class="collapse" id="order-3"><div class="detail-box mx-4 mb-3 p-3 rounded-3 bg-body-tertiary"><div class="row g-3 small">
                <div class="col-sm-5"><div class="text-body-secondary">Product</div><div class="fw-medium">iPad Pro 11", Wi-Fi</div></div>
                <div class="col-sm-3"><div class="text-body-secondary">Quantity</div><div class="fw-medium">1</div></div>
                <div class="col-sm-4"><div class="text-body-secondary">Ships to</div><div class="fw-medium">Paris, France</div></div>
              </div></div></div>
            </td></tr>
            <tr class="order-row" data-status="delivered">
              <td class="ps-4 text-nowrap"><span class="fw-semibold">#SO-13490</span><span class="d-block d-sm-none small text-body-secondary">B Mobiles</span><span class="d-md-none small text-body-secondary d-flex align-items-center gap-1 mt-1"><span class="status-dot bg-primary" aria-hidden="true"></span>Delivered</span></td>
              <td class="d-none d-sm-table-cell"><div class="d-flex align-items-center gap-2"><span class="avatar-initials bg-primary-subtle text-primary-emphasis" aria-hidden="true">BM</span><span class="fw-medium">B Mobiles</span></div></td>
              <td class="d-none d-md-table-cell"><span class="badge rounded-pill status-badge bg-primary-subtle text-primary-emphasis"><span class="status-dot bg-primary" aria-hidden="true"></span>Delivered</span></td>
              <td class="text-end pe-4 fw-semibold">$4,674.00</td>
              <td class="d-none d-lg-table-cell ps-4 text-body-secondary">March 22, 2026</td>
              <td class="pe-4 text-end">
                <button type="button" class="btn btn-sm border rounded-circle toggle-btn bg-body-tertiary text-body-emphasis" aria-expanded="false" aria-controls="order-4" aria-label="Show details for order SO-13490"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 6l4 4 4-4"/></svg></button>
              </td>
            </tr>
            <tr class="detail-row"><td colspan="6" class="p-0 border-0">
              <div class="collapse" id="order-4"><div class="detail-box mx-4 mb-3 p-3 rounded-3 bg-body-tertiary"><div class="row g-3 small">
                <div class="col-sm-5"><div class="text-body-secondary">Product</div><div class="fw-medium">Galaxy S24 Ultra</div></div>
                <div class="col-sm-3"><div class="text-body-secondary">Quantity</div><div class="fw-medium">4</div></div>
                <div class="col-sm-4"><div class="text-body-secondary">Ships to</div><div class="fw-medium">Madrid, Spain</div></div>
              </div></div></div>
            </td></tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.