shadcn.io is not affiliated with official shadcn/ui
Basic Task List Block for React
A plain task list with an add field, checkboxes that count what is done, delete and Clear done, and a one-line Undo that puts removed tasks back where they were.
Installation
Overview
Give people a task list that does the basics well, with this to-do list block for React with Base UI. A hairline frame with a plus mark on each corner holds an add band with a labelled Input and the only colored control, a Shine Button that adds the task at the top; an empty submit says "Write a task first" under the field and keeps focus there. Below it a held-height list shows seven tasks, each a Checkbox named by its title with a due date worked out from a fixed day ("Overdue 2 days", "Today", "Fri 16 Oct"), and a ghost button that deletes it. The foot counts what is done with a rolling Sliding Number, clears the finished tasks with an outline button, and keeps a one-line Undo for the last delete or clear. Delete every task and an Empty state fills the same space. Bands are ruled by Guides, and the only motion is a CSS entrance. For personal task apps, onboarding checklists and any product that starts with a list.
FAQ
How do I load my own tasks?
Replace START with your tasks. Each has an id, a title, a done flag and an optional ISO due date. Due labels are worked out against the AS_OF constant, a fixed "today" that keeps the server and every visitor in agreement; point it at the current date when you use real data.
What stays local, and how do I save for real?
Everything. Adding, ticking, deleting, clearing and undoing change state on the page and nothing is sent anywhere, so the list resets when you reload. In your app write each change from add, toggle, remove, clearDone and undo to your own store, and load the initial list from it.
How does Undo work?
Deleting a task or clearing the done ones removes them and shows one line, for example "Deleted 'Order paint samples'", with an Undo button. Undo puts them back at the same positions they had, not at the end. The line holds one removal; adding a task or removing another replaces it. There is no toast, so nothing disappears on a timer.
Is it accessible?
Each checkbox is named by its task title, the delete button names the task it removes, and the add field has a label. A single polite status message announces what changed ("Added 'x' at the top", "3 archived. Undo is available"). Done is shown by the checkbox, a muted color and a strike through the title, never by color alone, and Clear done stays focusable and answers when nothing is done.
Related
- Pro
A quiet task list with no row borders or counters: ticked tasks fold into a closed Done section, rows can be renamed in place, and one field at the foot adds a task.
- Pro
Eighteen tasks on shared hairlines in two columns, with a Compact and Comfortable row switch that never moves the page, and an Add task button that opens a row in the first cell.
- Pro
A task finder with a search field that marks matching words, All, Open and Done tabs with live counts, a foot that says what is showing, and an empty state with a way back.
- Pro
A task list where finished tasks carry an Archive button, one header action archives them all with an Undo, and a closing Archive section restores tasks one at a time or all at once.
- Pro
A priority backlog you reorder by dragging a grip or pressing Move up and Move down, with a live numbered Order list beside it and the new position announced after every move.
- Pro
A late-night task list that draws each check and runs a line through a finished title, with a soft glow on the row you are on and a rolling count of what is left.