Skip to content

Transactions table ​

A card with a searchable, responsive table of payments, status badges and pagination.

Installation ​

bash
npx bootcn add transactions-table
bash
pnpm dlx bootcn add transactions-table
bash
yarn dlx bootcn add transactions-table
bash
bunx --bun bootcn add transactions-table

The CLI also installs the design tokens and these blocks and components: card, badge, button, input. It prints the <link> and <script> tags to add to your layout.

Usage ​

Render one <tr> per transaction from your data. The search form submits q to the current page; handle it on the server, or filter rows with your own script.

On narrow screens the table scrolls sideways inside the card (.table-responsive) instead of squeezing the columns.

Accessibility ​

  • The table has a caption and scope="col" headers, so each cell is announced with its column.
  • Status is text in a badge, not colour alone.
  • The search form is a landmark named "Transactions", so it stays distinct from a site-wide search on the same page. The disabled "Previous" link uses aria-disabled="true" and is taken out of the tab order.

Dependencies ​

  • Bootstrap 5.3+ CSS.
  • themes/tokens/tokens.css.
  • The card component.
  • The badge component.
  • The button component.
  • The input component.

Source ​

The exact files the CLI installs (transactions-table@1.1.0). View on GitHub · Report an issue

html
<section class="card bootcn-card bootcn-transactions" aria-labelledby="bootcn-transactions-title">
  <header class="bootcn-card__header bootcn-transactions__header">
    <div>
      <h2 class="bootcn-card__title" id="bootcn-transactions-title">Recent transactions</h2>
      <p class="bootcn-card__description">Payments from the last 30 days.</p>
    </div>
    <form class="bootcn-transactions__tools" role="search" aria-label="Transactions" action="#">
      <label class="visually-hidden" for="bootcn-transactions-search">Search transactions</label>
      <input
        type="search"
        class="form-control bootcn-input bootcn-transactions__search"
        id="bootcn-transactions-search"
        name="q"
        placeholder="Search customers"
      />
      <button type="submit" class="visually-hidden">Search</button>
      <button type="button" class="btn bootcn-button bootcn-button--outline">
        <svg
          class="bootcn-icon"
          width="16"
          height="16"
          viewBox="0 0 24 24"
          fill="none"
          stroke="currentColor"
          stroke-width="2"
          stroke-linecap="round"
          stroke-linejoin="round"
          aria-hidden="true"
          focusable="false"
        >
          <path d="M12 4v12" />
          <path d="M7 11l5 5 5-5" />
          <path d="M5 20h14" />
        </svg>
        Export
      </button>
    </form>
  </header>
  <div class="table-responsive">
    <table class="table bootcn-transactions__table mb-0">
      <caption class="visually-hidden">
        Recent transactions, newest first
      </caption>
      <thead>
        <tr>
          <th scope="col">Customer</th>
          <th scope="col">Status</th>
          <th scope="col">Date</th>
          <th scope="col" class="text-end">Amount</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>
            <span class="bootcn-transactions__name">Maria Papadopoulou</span>
            <span class="bootcn-transactions__email">maria@example.com</span>
          </td>
          <td><span class="badge bootcn-badge bootcn-badge--default">Paid</span></td>
          <td><time datetime="2026-11-23">23 Nov 2026</time></td>
          <td class="text-end bootcn-transactions__amount">€250.00</td>
        </tr>
        <tr>
          <td>
            <span class="bootcn-transactions__name">Nikos Georgiou</span>
            <span class="bootcn-transactions__email">nikos@example.com</span>
          </td>
          <td><span class="badge bootcn-badge bootcn-badge--secondary">Pending</span></td>
          <td><time datetime="2026-11-22">22 Nov 2026</time></td>
          <td class="text-end bootcn-transactions__amount">€1,120.00</td>
        </tr>
        <tr>
          <td>
            <span class="bootcn-transactions__name">Eleni Kosta</span>
            <span class="bootcn-transactions__email">eleni@example.com</span>
          </td>
          <td><span class="badge bootcn-badge bootcn-badge--outline">Refunded</span></td>
          <td><time datetime="2026-11-21">21 Nov 2026</time></td>
          <td class="text-end bootcn-transactions__amount">€89.90</td>
        </tr>
        <tr>
          <td>
            <span class="bootcn-transactions__name">Alex Ioannou</span>
            <span class="bootcn-transactions__email">alex@example.com</span>
          </td>
          <td><span class="badge bootcn-badge bootcn-badge--destructive">Failed</span></td>
          <td><time datetime="2026-11-20">20 Nov 2026</time></td>
          <td class="text-end bootcn-transactions__amount">€430.00</td>
        </tr>
        <tr>
          <td>
            <span class="bootcn-transactions__name">Sofia Dimou</span>
            <span class="bootcn-transactions__email">sofia@example.com</span>
          </td>
          <td><span class="badge bootcn-badge bootcn-badge--default">Paid</span></td>
          <td><time datetime="2026-11-19">19 Nov 2026</time></td>
          <td class="text-end bootcn-transactions__amount">€72.50</td>
        </tr>
      </tbody>
    </table>
  </div>
  <footer class="bootcn-card__footer bootcn-transactions__footer">
    <p class="bootcn-transactions__summary">Showing 1–5 of 42</p>
    <nav class="bootcn-transactions__pages" aria-label="Transactions pages">
      <a
        class="btn bootcn-button bootcn-button--outline bootcn-button--sm"
        aria-disabled="true"
        tabindex="-1"
        >Previous</a
      >
      <a class="btn bootcn-button bootcn-button--outline bootcn-button--sm" href="#page-2">Next</a>
    </nav>
  </footer>
</section>
css
.bootcn-transactions__header {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.bootcn-transactions__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bootcn-transactions__search {
  width: auto;
  min-width: 12rem;
  flex: 1 1 12rem;
}

.bootcn-transactions__table {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--bootcn-border-color);
  font-size: 0.875rem;
}

.bootcn-transactions__table th {
  color: var(--bs-secondary-color);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.bootcn-transactions__table th:first-child,
.bootcn-transactions__table td:first-child {
  padding-left: var(--bootcn-card-padding);
}

.bootcn-transactions__table th:last-child,
.bootcn-transactions__table td:last-child {
  padding-right: var(--bootcn-card-padding);
}

.bootcn-transactions__table td {
  vertical-align: middle;
  white-space: nowrap;
}

.bootcn-transactions__name {
  display: block;
  color: var(--bs-emphasis-color);
  font-weight: 500;
}

.bootcn-transactions__email {
  display: block;
  color: var(--bs-secondary-color);
  font-size: 0.8125rem;
}

.bootcn-transactions__amount {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.bootcn-transactions__footer {
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
}

.bootcn-transactions__table thead th {
  border-top: var(--bootcn-border-width) solid var(--bootcn-border-color);
}

.bootcn-transactions__summary {
  margin: 0;
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
}

.bootcn-transactions__pages {
  display: flex;
  gap: 0.5rem;
}

Released under the MIT License. Not affiliated with Bootstrap or shadcn/ui.