A responsive invoice table for admin panels and billing dashboards, built with Bootstrap 6. Each row has a client avatar, amount, due date, status badge and a three-dot action Menu. Delete asks for confirmation in a Bootstrap 6 Dialog, and every action reports back in a Toast. Below 768 px the rows turn into compact stacked cards.
How it works
The table sits in .table-responsive.table-card and uses table-hover and md:table-stacked. .table-responsive is the query container. When it is narrower than 768 px, Bootstrap hides the header and stacks the cells, using each data-cell attribute as the label. A scoped @container rule in style.css puts label and value on one line and pins the action button to the card's top-right corner.
Each action cell has a .rta-toggle button with data-bs-toggle="menu", data-bs-placement="bottom-end" and data-bs-strategy="fixed". The fixed strategy lets the .menu escape the scrolling table wrapper. The data API opens the menus, so no init code is needed. Menu items carry data-rta-action values. One delegated click listener on <tbody> runs the matching function in the actions object, duplicated rows included.
paidchanges the badge through theSTATUSmap, disables "Mark as paid" and updates the Collected and Outstanding totals.remindchecks the status and shows a matching Toast.duplicateclones the row as a new draft with the next invoice number.deletefills.rta-dialog-idand opens the Dialog withDialog.getOrCreateInstance().show(). Afterhidden.bs.dialogthe row is removed and focus moves to the next row's menu button.
Due dates are stored as day offsets in data-rta-due. The script turns them into real dates relative to today, with hints such as "in 6 days" or "4 days ago", so the demo never looks outdated.
Customization
data-rta-amountanddata-rta-dueon each<tr>: set the amount used for the totals and the due date as days from today.- The
STATUSobject inscript.js: rename statuses or change theirtheme-*color and icon. --rta-accent,--rta-lateand--rta-bgon.rta-root: change the focus color, the overdue text color and the page background.- Replace
md:table-stackedwithlg:table-stackedto keep cards up to a 1024 px wide container. - Add
menu-itembuttons with a newdata-rta-actionand a function of the same name inactions. - Replace the demo
notify()calls withfetch()requests to your billing API.
Use cases
- Billing and invoicing: an invoice table with status badges shows what is paid or overdue
- Admin panels: a per-row action menu offers view, edit and delete
- Safe deletion: a confirmation dialog and toast feedback follow a delete
- Mobile admin pages: rows stack into cards on narrow screens
Accessibility
Each menu button has an aria-label that names its invoice, and the Menu plugin handles aria-expanded, arrow keys and Escape. The table has a visually hidden <caption> and scope="col" headers. Dates use <time datetime>. The Dialog is labelled and described by its title and text. The Toast is a polite status region, and the totals are a live region. The highlight on a duplicated row is disabled under prefers-reduced-motion.
Bootstrap 6 notes
Bootstrap 5's dropdown becomes a flat .menu with data-bs-toggle="menu". .modal becomes <dialog class="dialog">. badge bg-success becomes badge badge-subtle theme-success. table-responsive-md stacking is now md:table-stacked. Built on Bootstrap 6.0.0-alpha.1, so APIs can still change. Icons come from Bootstrap Icons.