Skip to content

Editable Table with Inline Editing

Dark Bootstrap 5 inventory table with click-to-edit cells, validation, live totals, an unsaved changes counter and simulated save and discard.

Also known as: inline editable table, click to edit table, editable data grid, inventory table editor, editable table cells

Bootstrap 5 Tables Responsive Dark #dark #dashboard #editable #inline-edit #table

Editable Table with Inline Editing live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

A dark Bootstrap 5 data table whose cells can be edited in place: click a value, change it in a text field, number field or select, and press Enter. Changed cells are marked, row values and totals update immediately, and a toolbar saves or discards all changes at once. Use it for admin panels, inventory lists, price sheets and other back-office screens.

How it works

The root is section.eit-root with data-bs-theme="dark", so Bootstrap's table and form styles switch to their dark versions. Inside .eit-card you find the .eit-head toolbar and a table.eit-table in a table-responsive wrapper. Each editable td has the class eit-cell and three data attributes: data-field (name, category, stock or price), data-type (text, number or select) and data-value. Number cells also use data-step (1 for whole numbers, 0.01 for prices).

On DOMContentLoaded the script stores each starting value in data-original and render() turns the cell into an .eit-edit button with a pencil icon. A click opens edit(), which replaces the button with an .eit-input; select cells copy their options from the template.eit-options element. Enter runs validate() and stores the cleaned value, Escape cancels, and leaving the field saves a valid value or discards an invalid one. A cell whose value differs from data-original gets is-dirty, which adds an amber tint and dot.

After every change update() recalculates the .eit-total of each row, the footer sums and the .eit-count badge, and enables or disables .eit-save and .eit-discard. Saving shows a spinner, then copies the values into data-original and flashes the saved cells with is-saved. Messages appear in .eit-status.

Customization

  • --eit-accent in .eit-root: recolor the save button, focus rings, pencil icons and the save flash.
  • --eit-dirty in .eit-root: change the color of the changed-cell dot and the counter badge.
  • --eit-bg, --eit-card and --eit-line in .eit-root: adjust the page, card and border colors.
  • The option elements in template.eit-options: set the categories offered in the select editor.
  • data-step="1" or data-step="0.01" on number cells: allow only whole numbers or two decimals.
  • Remove data-original="54" from the Packable Rain Jacket stock cell to start without unsaved changes.
  • The window.setTimeout in the .eit-save click handler of script.js: replace it with a fetch() that sends the changed rows to your API.

Use cases

  • Admin panels: staff click a value to edit text, numbers or categories directly in the table
  • Inventory lists: stock and price cells recalculate row totals and footer sums live
  • Price sheets: changed cells are marked and a toolbar saves or discards all edits at once
  • Back-office tools: validation keeps invalid values from being stored while editing
  • Dark dashboards: a counter shows how many unsaved changes are pending

Accessibility

Every editable value is a real button, so it can be reached with Tab and opened with Enter or Space. Its aria-label names the column, the product and the current value, and the editor field gets a matching label. Invalid input gets aria-invalid and keeps focus. After saving or cancelling, focus returns to the cell button. The counter uses aria-live, .eit-status uses role="status", and the table is described by the usage hint. The pencil icons are aria-hidden, and the flash animation is removed under prefers-reduced-motion: reduce.

Usage notes

Requires Bootstrap 5 and Bootstrap Icons. On small screens the table scrolls horizontally inside table-responsive. Always validate the values again on the server.

Editable Table with Inline Editing at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5, Bootstrap Icons
Layout
Responsive, works on mobile, dark design
Category
Tables
License
Free for personal and commercial use

Questions about this template

Can I use the Editable Table with Inline Editing code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
Editable Table with Inline Editing – Bootstrap 5 tables component screenshot
Editable Table with Inline Editing · Bootstrap 5 Tables

More Tables

Table with Search Filter – Bootstrap 5 tables preview

Table with Search Filter

Bootstrap 5 team directory table with live search, status filter, highlighted matches, result counter and empty state.

Sortable Data Table – Tailwind CSS tables preview

Sortable Data Table

Tailwind CSS data table with clickable column headers that sort text, dates and numbers, with aria-sort, arrow indicators and a responsive scroll wrapper.

Product Comparison Table Section for Shopify – Shopify tables preview

Product Comparison Table Section for Shopify

Shopify section with a real comparison table for 2 to 4 products: live prices, yes/no icons, row values set in the theme editor, and a sticky first column when it scrolls on phones.

Table with Sticky Header – Pure CSS tables preview

Table with Sticky Header

Dark striped data table in pure CSS with a sticky header row and sticky first column inside a scrollable, keyboard-focusable container.

Responsive Table with Actions – Bootstrap 5 tables preview

Responsive Table with Actions

Responsive Bootstrap 5 invoice table with status badges, a status filter and row action dropdowns to mark as paid, remind or delete.