Skip to content

Expandable Row

A copy-paste tables & data grids component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Tables & Data GridsHTMLCSSany framework
OrderTotal
#ORD-001$128.00
• Orbit Pro × 2• Shipping: $8.00• Tax: $12.00
#ORD-002$54.00

Copy into your project

HTML
<div class="nuda-tbl-expand">
  <table class="nuda-tbl-expand__table">
    <thead>
      <tr>
        <th class="nuda-tbl-expand__th" style="width:24px"></th>
        <th class="nuda-tbl-expand__th">Order</th>
        <th class="nuda-tbl-expand__th">Total</th>
      </tr>
    </thead>
    <tbody>
      <!-- expanded row -->
      <tr class="nuda-tbl-expand__row">
        <td class="nuda-tbl-expand__td">
          <span class="nuda-tbl-expand__toggle nuda-tbl-expand__toggle--open">▾</span>
        </td>
        <td class="nuda-tbl-expand__td">#ORD-001</td>
        <td class="nuda-tbl-expand__td">$128.00</td>
      </tr>
      <tr class="nuda-tbl-expand__detail">
        <td></td>
        <td class="nuda-tbl-expand__detail-cell" colspan="2">
          <div class="nuda-tbl-expand__detail-body">
            <span>• Orbit Pro × 2</span>
            <span>• Shipping: $8.00</span>
            <span>• Tax: $12.00</span>
          </div>
        </td>
      </tr>
      <!-- collapsed row -->
      <tr class="nuda-tbl-expand__row">
        <td class="nuda-tbl-expand__td">
          <span class="nuda-tbl-expand__toggle">▸</span>
        </td>
        <td class="nuda-tbl-expand__td">#ORD-002</td>
        <td class="nuda-tbl-expand__td">$54.00</td>
      </tr>
    </tbody>
  </table>
</div>
CSS
.nuda-tbl-expand {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.1);
  overflow: hidden;
  background: #141414;
}

.nuda-tbl-expand__table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}

.nuda-tbl-expand__th {
  padding: .5rem .75rem;
  text-align: left;
  color: #777;
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #1a1a1a;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.nuda-tbl-expand__td {
  padding: .45rem .75rem;
  color: #cfcfcf;
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.nuda-tbl-expand__row:last-child .nuda-tbl-expand__td {
  border-bottom: none;
}

.nuda-tbl-expand__toggle {
  cursor: pointer;
  color: #e4ff54;
  font-size: .9rem;
  line-height: 1;
  user-select: none;
  transition: transform .2s;
}

.nuda-tbl-expand__toggle--open {
  display: inline-block;
}

.nuda-tbl-expand__detail {
  background: #1a1a1a;
}

.nuda-tbl-expand__detail-cell {
  padding: .3rem .75rem .6rem;
}

.nuda-tbl-expand__detail-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #777;
  font-size: .72rem;
  animation: _nuda-tblslide .2s ease-out;
}

@keyframes _nuda-tblslide {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-tbl-expand__detail-body {
    animation: none;
  }
}

How to use Expandable Row

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More tables & data grids components

← Browse all NudaUI components