A modern, responsive Todo List application built using HTML, CSS, and JavaScript, featuring light/dark theme toggle, task filtering, and interactive UI animations.
- Add, edit, and delete tasks
- Mark tasks as completed
- Filter tasks (All / Active / Completed)
- Save tasks in localStorage
- Animated task addition/removal
- Light/Dark theme switch with smooth transitions
- Responsive design for mobile & desktop
- Custom scrollbars and focus styles for accessibility
- HTML5 – Structure
- CSS3 – Styling, CSS Variables, Responsive Design
- JavaScript (ES6) – DOM Manipulation, Event Handling
- CSS Animations – Smooth UI transitions
project/ │── index.html # Main HTML file │── style.css # Main CSS file │── script.js # JavaScript logic │── assets/ # (Optional) icons/images │── README.md # Documentation
- Clone or download the project
- Open
index.htmlin a browser - Add a task using the input field
- Click the theme toggle button to switch between light and dark mode
- Use filter buttons to sort tasks
- Click on a task's checkbox to mark it complete
- Header: Contains app title and theme toggle button
- Input Section: Text input + Add button
- Filters: Buttons to filter tasks
- Todo List: Dynamic list populated via JS
- Stats: Shows total, completed, remaining tasks
- CSS Variables: Define colors, shadows, and radius in
:rootfor light mode and override in.dark-mode - Dark Mode Styling:
.dark-modechanges--background,--text-primary, etc. - Animations:
@keyframes slideIn&slideOutfor task transitions - Responsive Rules:
@media (max-width: 640px)for mobile UI optimization
- State Management: Tasks stored in an array and in localStorage for persistence
- Functions:
addTodo()→ Add new tasktoggleTodo(id)→ Mark as completed/uncompletededitTodo(id)→ Edit task textdeleteTodo(id)→ Remove taskfilterTodos(filter)→ Show filtered tasksupdateStats()→ Update total/active/completed counts
- Theme Toggle:
- Save selected theme to localStorage
- Apply theme on page load
CSS Variables make theme switching instant:
:root {
--background: #ffffff;
--text-primary: #1e293b;
}
.dark-mode {
--background: #0f172a;
--text-primary: #f1f5f9;
}function toggleTheme() {
const body = document.body;
body.classList.toggle('dark-mode');
localStorage.setItem('theme', body.classList.contains('dark-mode') ? 'dark' : 'light');
}| Element / Feature | Language | Purpose |
|---|---|---|
<header> |
HTML | Page title & theme button |
<input> |
HTML | Task entry field |
<button> |
HTML | Actions (add, filter, delete) |
.container |
CSS | Layout container |
:root |
CSS | Global variables |
.dark-mode |
CSS | Dark theme overrides |
@keyframes |
CSS | Animations |
querySelector |
JS | DOM element selection |
addEventListener |
JS | Event handling |
classList.toggle |
JS | Add/remove class |
forEach |
JS | Loop through tasks |
+--------------------------------------------------+ | Todo App [☀/🌙 Toggle] | +--------------------------------------------------+ | [ Enter new task... ][ Add Task ] | +--------------------------------------------------+ | [All] [Active] [Completed] | +--------------------------------------------------+ | ☐ Task 1 [Edit] [Delete] | | ☑ Task 2 (done) [Edit] [Delete] | | ☐ Task 3 [Edit] [Delete] | +--------------------------------------------------+ | Total: 3 Completed: 1 Remaining: 2 | +--------------------------------------------------+
This project is open-source and free to use.