To-do
Grouped tasks with a spring tick on a native checkbox, drag & drop (or Alt+↑/↓ from the keyboard) with a breathing drop pill, a rolling done/total counter, a progress bar that fills, and a quick-add that drops the new task in the group you pick.
Real scenarios
The component as it is used in a product — not a specimen grid.
The support lead’s day
Tick a task — the checkbox is native, so the space bar works and the tick springs; the counter and the bar roll as it lands. Drag a task into another group (the pill breathes where it will drop) or walk it with Alt+↑/↓ straight from the keyboard. «بعداً» starts empty on purpose: it is a drop target, and the quick-add’s select puts the new task in whichever group you name. Both moves report back through a toast — the nx-toggle and nx-move events riding the list.
My day
2 of 5 done-
Today
3 tasks -
This week
2 tasks -
Later
0 tasks- No tasks yet
Without the wire actions the list owns its state client-side and tells you through events; pass toggle-action="toggleTask" and friends and the groups you hand in become the single truth, re-rendered after every optimistic change.
The 2.5 release checklist
A checklist that is not supposed to grow mid-flight: quick-add is off. ۳ of ۵ are done — tick the last two and when the bar fills the whole board takes data-complete, a cue beyond the numbers alone. Every tick also announces itself to screen readers from inside the component, so nothing here depends on the toasts.
Shipping v2.5
3 of 5 done-
The release
5 tasks
The shop’s Norooz buying list
Progress is off — only the heading stays, no counter, no bar; a buying list does not need percentages. The «Until the Norooz sale» group starts empty: pick it in the quick-add’s select, type, press Enter, and the new task lands there — the toast rides the nx-add event. Removing a task ripples the rest of the list up with the same glide.
Norooz buying
-
This week
3 tasks -
Until the Norooz sale
0 tasks- No tasks yet
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| groups | array | [] | Each group: ['id' => …, 'title' => …, 'tone' => accent|success|warning|danger|info|gold, 'tasks' => [['id' => …, 'title' => …, 'done' => true]]] — the groups you pass are the truth. |
| toggle-action / remove-action / add-action / move-action | string | null | Livewire method names: toggleTask($task, $done), removeTask($task), addTask($group, $title) and moveTask($task, $from, $to, $index) — called after the optimistic change, so hand the groups back and the tasks glide through the morph on their wire:key. Without them everything stays client-side and the nx-toggle / nx-remove / nx-add / nx-move events bubble from the component. |
| quickAdd / progress | bool | true / true | The quick-add composer (with several groups it grows a group select) and the rolling done/total counter with its bar; when every task is done the board takes data-complete. |
| heading / label | string | null | The list’s visible heading and its accessible name (aria-label). |
| locale | string | زبان اپ | The locale for digits and the component’s own words (the add placeholder, the empty text, remove…), which come from the core i18n table — fa/en/ar. |
Snippet
<x-nx::todo heading="برنامهٔ امروز" :groups="[
['id' => 'today', 'title' => 'امروز', 'tone' => 'warning', 'tasks' => [
['id' => 't1', 'title' => 'پاسخ به تیکت ۱۲۴۸', 'done' => true],
['id' => 't2', 'title' => 'تماس با تأمینکننده'],
]],
['id' => 'later', 'title' => 'بعداً', 'tone' => 'info', 'tasks' => []],
]" toggle-action="toggleTask" remove-action="removeTask"
add-action="addTask" move-action="moveTask" />
{{-- بدون اتصال لایووایر: رویدادها را خودتان میگیرید --}}
<x-nx::todo :groups="$groups" x-on:nx-toggle="$wire.ping('تیک خورد')" />