2.4 KiB
2.4 KiB
Svelte Todo List - Design
Overview
A simple todo list application built with Svelte. Supports creating, completing, and deleting todos with localStorage persistence.
Features
- Add new todos
- Mark todos as complete/incomplete
- Delete todos
- Filter by: All / Active / Completed
- Clear all completed todos
- Persist to localStorage
- Show count of remaining items
User Interface
┌─────────────────────────────────────────┐
│ Svelte Todos │
├─────────────────────────────────────────┤
│ [________________________] [Add] │
├─────────────────────────────────────────┤
│ [ ] Buy groceries [x] │
│ [✓] Walk the dog [x] │
│ [ ] Write code [x] │
├─────────────────────────────────────────┤
│ 2 items left │
│ [All] [Active] [Completed] [Clear ✓] │
└─────────────────────────────────────────┘
Components
src/
App.svelte # Main app, state management
lib/
TodoInput.svelte # Text input + Add button
TodoList.svelte # List container
TodoItem.svelte # Single todo with checkbox, text, delete
FilterBar.svelte # Filter buttons + clear completed
store.ts # Svelte store for todos
storage.ts # localStorage persistence
Data Model
interface Todo {
id: string; // UUID
text: string; // Todo text
completed: boolean;
}
type Filter = 'all' | 'active' | 'completed';
Acceptance Criteria
- Can add a todo by typing and pressing Enter or clicking Add
- Can toggle todo completion by clicking checkbox
- Can delete a todo by clicking X button
- Filter buttons show correct subset of todos
- "X items left" shows count of incomplete todos
- "Clear completed" removes all completed todos
- Todos persist across page refresh (localStorage)
- Empty state shows helpful message
- All tests pass