Overview
TheTodoList component provides a fully-featured task management interface with local storage persistence. It supports task creation, completion tracking, importance marking, drag-and-drop reordering, and context-menu based filtering and sorting.
Props
When
true, the component expands to fill available width and removes the max-height constraint. Used when the TodoList is displayed as a standalone widget.Usage
Basic Implementation
Full-Size Mode
src/app.tsx:112:
State Management
The component usesuseLocalStorage hooks to persist data across sessions:
Todos Storage
Sort Mode Storage
Filters Storage
Types and Interfaces
Todo
Fromsrc/types/todo.ts:1:
SortMode
Fromsrc/types/todo.ts:9:
TodoFilters
Fromsrc/types/todo.ts:11:
Features
Task Management
- Add Tasks: Enter text in the input field and press Enter or click the plus button
- Complete Tasks: Click the checkbox to mark tasks as complete/incomplete
- Delete Tasks: Hover over a task and hold the delete button for 1.5 seconds
- Mark Important: Right-click a task and select “mark important” to add a star indicator
Sorting Options
Accessed via right-click context menu on the card:- Manual Order: Default mode, allows drag-and-drop reordering
- Oldest First: Sorts by
createdAttimestamp ascending - Newest First: Sorts by
createdAttimestamp descending
Filtering Options
Accessed via right-click context menu on the card:- Hide Completed: Hides tasks where
completedistrue - Show Important Only: Shows only tasks where
importantistrue
Drag and Drop
Drag-and-drop reordering is enabled whensortMode is set to "manual". The component uses Framer Motion’s Reorder components for smooth animations.
From src/components/todo-list.tsx:195:
Animation
Tasks animate in and out using Framer Motion’sAnimatePresence:
Dependencies
motion/react- Animation and drag-and-drop functionality@tabler/icons-react- UI icons@/hooks/use-local-storage- Data persistence@/lib/todo-utils- Filtering and sorting utilities@/components/ui/*- Shadcn UI components
Related Components
- QuickLinks - Companion widget for link management
- InteractiveCalendar - Companion widget for mood tracking