Search 71 components and 72 controllers by name, category or description.
How it’s built
Explore the Blade and Laravel code behind the Task Manager.
The filters are a GET form. Auto-submit sends changes to the results frame, and the query string makes the filtered board shareable.
<hw:form
method="get"
:action="route('tasks.index')"
frame="results"
clean-query-params
auto-submit
:class="\Illuminate\Support\Arr::toCssClasses([
'grid gap-3 rounded-xl border bg-card p-4 @2xl:grid-cols-2',
'@6xl:grid-cols-[minmax(16rem,1fr)_auto_12rem_8rem_auto_auto]' => $view !== 'kanban',
'@6xl:grid-cols-[minmax(16rem,1fr)_12rem_auto_auto]' => $view === 'kanban',
])"
:data-reveal-skip="($skipFilterReveal ?? false) ? '' : null"
role="search"
>
<hw:input-group>
<hw:input
name="search"
aria-label="Search tasks"
placeholder="Search tasks..."
:value="request('search')"
auto-submit="debounced"
clearable
auto-select
/>
<hw:input-group.addon align="inline-start">
<x-lucide-search class="size-4" aria-hidden="true" />
</hw:input-group.addon>
</hw:input-group>
@if ($view !== 'kanban')
<hw:toggle-group
type="single"
name="status"
:value="request('status')"
:options="$statuses"
aria-label="Filter by status"
variant="outline"
connected
auto-submit
class="self-center"
/>
@endif
<hw:select
name="due"
aria-label="Filter by due date"
:options="[
'' => 'Any due date',
'overdue' => 'Overdue',
'today' => 'Due today',
'tomorrow' => 'Tomorrow',
'none' => 'No due date',
]"
:selected="request('due')"
auto-submit
/>
@if ($view !== 'kanban')
<hw:select
name="per_page"
aria-label="Tasks per page"
:options="['12' => '12 / page', '24' => '24 / page', '48' => '48 / page']"
:selected="(string) request('per_page', 12)"
auto-submit
/>
@endif
{{-- Keep the board mode when the filter form targets only the results frame. --}}
@if ($view === 'kanban')
<input type="hidden" name="view" value="kanban">
@endif
<hw:button-group aria-label="Board view" class="self-center">
<hw:button
as="a"
:href="route('tasks.index', \Illuminate\Support\Arr::except(request()->query(), ['view', 'page']))"
:variant="$view === 'kanban' ? 'outline' : 'default'"
:aria-current="$view === 'kanban' ? null : 'page'"
>
<x-lucide-layout-grid class="size-4" />
List
</hw:button>
<hw:button
as="a"
:href="route('tasks.index', [...\Illuminate\Support\Arr::except(request()->query(), ['status', 'per_page', 'page']), 'view' => 'kanban'])"
:variant="$view === 'kanban' ? 'default' : 'outline'"
:aria-current="$view === 'kanban' ? 'page' : null"
>
<x-lucide-columns-3 class="size-4" />
Kanban
</hw:button>
</hw:button-group>
<div class="flex items-center gap-2">
<noscript>
<hw:button type="submit" size="sm">Apply</hw:button>
</noscript>
</div>
</hw:form>
public function rules(): array
{
return [
'search' => ['nullable', 'string', 'max:100'],
'status' => ['nullable', Rule::enum(TaskStatus::class)],
'due' => ['nullable', Rule::in(['overdue', 'today', 'tomorrow', 'none'])],
'per_page' => ['nullable', 'integer', Rule::in([12, 24, 48])],
'page' => ['nullable', 'integer', 'min:1'],
'view' => ['nullable', Rule::in(['list', 'kanban'])],
];
}
The New task link targets the shared modal frame. Opening the same URL directly renders the form as a full page.
<hw:button id="new-task-button" as="a" :href="route('tasks.create', request()->query())" frame="modal" class="shrink-0">
<x-lucide-plus class="size-4" />
New task
</hw:button>
<hw:modal size="sm" frame="modal" view-transition class="[view-transition-name:task-modal]">
<x-slot:loading_template>
<div class="flex items-center justify-center p-12">
<hw:spinner/>
</div>
</x-slot:loading_template>
</hw:modal>
public function create(Request $request): View
{
return view('tasks.create', [
'task' => new Task(['status' => TaskStatus::Pending]),
'statuses' => TaskStatus::options(),
'boardQuery' => $this->createBoardQuery($request),
]);
}
<hw:frame-or-page frame="modal" layout="layouts.tasks">
<hw:frame-or-page.page>
@section('topbar')
<hw:breadcrumb collapse-below="md" :items="[
['label' => 'Laravel Hotwire', 'href' => route('components.introduction')],
['label' => 'Task manager', 'href' => route('tasks.index', $boardQuery)],
['label' => 'Create task'],
]" />
@endsection
</hw:frame-or-page.page>
{{-- O atraso deixa o modal (200ms) assentar antes de a cascata dos campos começar. --}}
<hw:reveal
motion="flat"
delay="110ms"
stagger="55ms"
duration="440ms"
class="mx-auto w-full max-w-2xl p-5 sm:p-6"
>
<div data-reveal-item class="mb-6 space-y-1">
<h1 class="text-xl font-semibold">Create a task</h1>
<p class="text-sm text-muted-foreground">Capture the next concrete outcome for the launch team.</p>
</div>
<hw:form
:action="route('tasks.store', $boardQuery)"
method="post"
track-frame-src
error-scroll
conditional-fields
:state="['status' => old('status', $task->status?->value)]"
class="grid gap-6"
>
@include('tasks._form')
<div data-reveal-item style="--reveal-index: 5" class="flex flex-wrap justify-end gap-2 border-t pt-5">
<hw:frame-or-page.frame>
<hw:modal.close>Cancel</hw:modal.close>
</hw:frame-or-page.frame>
<hw:frame-or-page.page>
<hw:button as="a" :href="route('tasks.index', $boardQuery)" variant="outline">Cancel</hw:button>
</hw:frame-or-page.page>
<hw:button type="submit">
<hw:spinner class="hidden form-busy:block text-primary-foreground" />
<span class="form-busy:hidden">Create task</span>
</hw:button>
</div>
</hw:form>
</hw:reveal>
</hw:frame-or-page>
One controller action serves both the full board and the results frame. The frame adds filtered URLs to history and preserves scroll.
<hw:frame id="results" advance preserve-scroll>
@if (request()->wasFromTurboFrame('results'))
@include('tasks._results')
@elseif (request()->wasFromTurboFrame('task-board'))
@include('tasks._workspace', ['skipFilterReveal' => true])
@else
public function index(TaskIndexRequest $request): View
{
$filters = $request->validated();
$view = ($filters['view'] ?? 'list') === 'kanban' ? 'kanban' : 'list';
if ($view === 'kanban') {
return view('tasks.index', [
'view' => $view,
'columns' => $this->kanbanColumns($filters),
'statuses' => TaskStatus::options(),
]);
}
return view('tasks.index', [
'view' => $view,
'tasks' => $this->paginateTasks($filters),
'statuses' => TaskStatus::options(),
]);
}
View opens a modal and Edit can open a sheet or update the details modal in place. Delete is a form wrapped in a confirmation dialog.
<article id="{{ dom_id($task) }}" data-reveal-item @if ($revealSkip ?? false) data-reveal-skip @endif class="h-full">
<hw:card class="h-full [--card-spacing:--spacing(5)]">
<hw:card.header>
<div data-card-status class="flex flex-wrap items-center gap-2">
@include('tasks._card_status', ['cardStatus' => $task->status])
</div>
<hw:card.action class="flex items-center gap-1">
<hw:button
as="a"
:href="$showUrl"
frame="modal"
size="sm"
variant="ghost"
aria-label="View {{ $task->title }}"
>
<x-lucide-eye class="size-4" />
</hw:button>
<hw:button
as="a"
:href="$editUrl"
frame="settings-panel"
size="sm"
variant="ghost"
aria-label="Edit {{ $task->title }}"
>
<x-lucide-square-pen class="size-4" />
</hw:button>
<hw:form :action="$destroyUrl" method="delete">
<hw:alert-dialog
:id="$task"
title="Delete this task?"
description="This action cannot be undone."
confirm-label="Delete task"
confirm-variant="destructive"
:close-on-click-outside="false"
>
<hw:button
type="submit"
size="sm"
variant="ghost"
class="text-destructive hover:text-destructive"
aria-label="Delete {{ $task->title }}"
>
<x-lucide-trash-2 class="size-4" />
</hw:button>
</hw:alert-dialog>
</hw:form>
</hw:card.action>
</hw:card.header>
<hw:card.content class="flex flex-1 flex-col gap-3">
<a href="{{ $showUrl }}" data-turbo-frame="_top" class="group/title min-w-0">
<h2 class="wrap-break-word font-semibold leading-snug tracking-tight group-hover/title:text-primary {{ $isDone ? 'line-through opacity-70' : '' }}">
{{ $task->title }}
</h2>
</a>
<p class="line-clamp-3 text-sm leading-6 text-muted-foreground">
{{ $task->description ?: 'No description has been added yet.' }}
</p>
</hw:card.content>
<hw:card.footer class="flex items-center justify-between gap-3 text-xs text-muted-foreground">
@if ($task->due_date)
<span class="inline-flex items-center gap-1.5 {{ $isOverdue ? 'font-medium text-destructive' : '' }}">
<x-lucide-calendar-days class="size-3.5" />
<time datetime="{{ $task->due_date->toDateString() }}">
@if ($task->due_date->isSameDay($today))
Due today
@elseif ($task->due_date->isSameDay($tomorrow))
Due tomorrow
@else
Due {{ $task->due_date->format('M j') }}
@endif
</time>
</span>
@else
<span class="inline-flex items-center gap-1.5">
<x-lucide-calendar-off class="size-3.5" />
No due date
</span>
@endif
<span title="Created {{ $task->created_at->format('M j, Y') }}">
{{ $task->created_at->diffForHumans(short: true) }}
</span>
</hw:card.footer>
</hw:card>
</article>
<hw:frame-or-page :frames="['settings-panel', 'modal']" layout="layouts.tasks">
/** Delete the task and reconcile the board without refreshing other drafts. */
public function destroy(Request $request, Task $task): mixed
{
$overlayFrame = $this->taskOverlayFrame($request);
$task->delete();
$frame = $request->turboFrameId();
if ($overlayFrame === null && $frame !== 'results') {
return to_route('tasks.index', $this->boardQuery($request))->with('success', 'Task deleted successfully.');
}
$streams = $this->boardStreams($request);
if ($overlayFrame !== null) {
$streams = $this->closeTaskOverlay($streams, $overlayFrame);
}
return $streams->toast('success', 'Task deleted', 'The task was permanently removed.');
}
Laravel paginates the query as usual. The incremental paginator appends the next page to the existing grid.
<hw:pagination
:paginator="$tasks->onEachSide(1)"
label="Task pages"
previous-aria-label="Go to previous task page"
next-aria-label="Go to next task page"
incremental
append-to="#tasks"
load-more-label="Load more tasks"
loading-label=""
/>
/** @param array<string, mixed> $filters */
private function paginateTasks(array $filters): LengthAwarePaginator
{
$query = $this->filteredTaskQuery($filters)
->orderByDesc('created_at')
->orderByDesc('id');
$perPage = $filters['per_page'] ?? 12;
$requestedPage = max(1, (int) request()->query('page', 1));
$tasks = (clone $query)->paginate($perPage, ['*'], 'page', $requestedPage);
if ($requestedPage > $tasks->lastPage()) {
$tasks = (clone $query)->paginate($perPage, ['*'], 'page', $tasks->lastPage());
}
return $tasks
->withPath(route('tasks.index'))
->withQueryString();
}