Interactive Checklist Template
An interactive to-do list where users can check items off and track their completion with a progress bar.
This component is perfect for task lists, onboarding guides, or any sequential process where tracking progress is beneficial.

About this Template
This component combines semantic list markup with custom-styled checkboxes and JavaScript-driven interactivity. When a user clicks a checkbox, the corresponding item is visually marked as complete (with a strikethrough), and a progress bar at the top of the list updates in real-time. The code is lightweight, dependency-free, and fully self-contained.
Features
- Real-time Progress Bar: A visual progress bar updates automatically as items are checked or unchecked.
- Custom Checkbox Styles: Replaces the default browser checkboxes with beautifully styled custom ones for a consistent look across all browsers.
- Accessible Structure: Uses proper
label
elements with thefor
attribute, ensuring checkboxes are accessible to everyone. - Pure JavaScript Logic: All interactivity is handled by a small, efficient vanilla JavaScript snippet with no external libraries.
- Self-Contained: The entire component's HTML, CSS, and JavaScript are scoped and ready to be dropped into any project.
Code Breakdown
The structure is based on a ul
element. Each li
contains a hidden input type="checkbox"
and a label
. The label's for
attribute is tied to the checkbox's id
, which is critical for accessibility. We hide the default checkbox and use the label's ::before
pseudo-element to create a custom one.
The JavaScript listens for the change
event on all checkboxes. When an event occurs, it adds or removes a .completed
class on the parent li
. This class is what triggers the strikethrough effect on the label text and changes the appearance of our custom checkbox.
After each change, a separate function is called to update the progress bar. It counts the total number of checkboxes, counts how many are checked, calculates the percentage, and updates the width of the progress bar's inner element accordingly.
Code
Here's the full code for the template: