Table with Inline Action Buttons Template
Empower users to manage data directly from the list with clear, inline action buttons in every row.
Essential for any admin panel or CRUD (Create, Read, Update, Delete) interface, this design provides an intuitive way for users to interact with individual items.

About this "Action Buttons" Table
This template moves actions from a single, page-level location to the context of each data row. This vastly improves workflow efficiency for common tasks like editing, deleting, or viewing an item. The template places a set of small, icon-based buttons in the last column of the table, ensuring they are always available next to the item they control.
The JavaScript uses an efficient "event delegation" pattern. Instead of adding a separate click listener to every single button, it adds just one listener to the entire table body. When a click occurs, it checks if the target was a button and then identifies which row was clicked and which specific action was requested. Each row uses a data-id
attribute to uniquely identify the data record, which is passed to the action handler.
Key Features:
- Contextual Actions: Buttons are placed directly in the row, making their function unambiguous.
- Improved Workflow: Speeds up data management tasks by reducing clicks and navigation.
- Space-Efficient Icon Buttons: Uses SVG icons to keep the buttons small and universally understood.
- Efficient Event Handling: Demonstrates a best-practice JavaScript pattern (event delegation) for optimal performance.
Implementation Notes:
The included JavaScript shows how to capture the "click" event and identify which item and action were chosen, showing an alert()
for demonstration. To implement this in your application, you would replace these alerts with your own logic, such as:
- Making an API call to a server to delete an item.
- Opening a modal window with an editing form.
- Redirecting the user to a detailed view page.
Code
Here's the full code, including the HTML for the buttons and JavaScript for handling clicks: