Search 71 components and 72 controllers by name, category or description.
Form
Laravel form with CSRF, method spoofing, Turbo Frames, auto-submit, validation error focus and unsaved-change protection
CSRF and method spoofing
hw:form emits @csrf for every non-GET method and @method for PUT, PATCH and DELETE. Adding either by hand is a duplicate, not a safety net.
{{-- POST: @csrf is emitted for you. Never add it by hand. --}}
<hw:form :action="route('components.form')" method="post" class="rounded-lg border p-4">
<p class="text-sm font-medium">method="post"</p>
<p class="mt-1 text-sm text-muted-foreground">Emits the CSRF token, no method field.</p>
</hw:form>
{{-- PUT / PATCH / DELETE: @csrf plus the spoofing field. --}}
<hw:form :action="route('components.form')" method="patch" class="rounded-lg border p-4">
<p class="text-sm font-medium">method="patch"</p>
<p class="mt-1 text-sm text-muted-foreground">Emits CSRF and <code>_method</code>.</p>
</hw:form>
{{-- GET: neither. --}}
<hw:form :action="route('components.form')" method="get" class="rounded-lg border p-4">
<p class="text-sm font-medium">method="get"</p>
<p class="mt-1 text-sm text-muted-foreground">Neither field is emitted.</p>
</hw:form>
Validation flow
Submit the form empty to see server-side validation errors mapped back into each field. Submit valid data to see the success alert.
<hw:form
method="post"
:action="route('components.form.submit')"
error-scroll
unsaved-changes
novalidate
data-controller="form-validation"
>
<hw:field.set class="grid gap-6">
<div class="flex items-start gap-3">
<x-lucide-clipboard-check class="mt-1 size-5 text-muted-foreground" />
<hw:field.content>
<hw:field.legend>Project brief</hw:field.legend>
<hw:field.description>Submit empty data to see server-side validation mapped back into each field.</hw:field.description>
</hw:field.content>
</div>
<div class="flex flex-col gap-3 rounded-lg border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between">
<div class="grid gap-1">
<p class="text-sm font-medium">Browser validation</p>
<p class="text-sm text-muted-foreground">The form starts with <code>novalidate</code> so empty submissions reach Laravel.</p>
</div>
<hw:toggle pressed variant="outline" data-action="change->form-validation#toggle">
<x-lucide-shield-off class="size-4" />
Backend validation only
</hw:toggle>
</div>
<hw:field.group class="grid gap-4 sm:grid-cols-2">
<hw:field name="project_name" label="Project name" description="Required, 3 to 255 characters." required>
<hw:input placeholder="Website redesign" minlength="3" maxlength="255" />
</hw:field>
<hw:field name="owner_email" label="Owner email" required>
<hw:input type="email" placeholder="owner@example.com" />
</hw:field>
</hw:field.group>
<hw:field.group class="grid gap-4 md:grid-cols-[220px_1fr]">
<hw:field name="priority" label="Launch priority" required>
<hw:select
placeholder="Choose priority"
:options="['low' => 'Low', 'medium' => 'Medium', 'high' => 'High']"
/>
</hw:field>
<hw:field name="summary" label="Project summary" description="Required, 20 to 240 characters." required>
<hw:textarea
placeholder="Describe what this project should ship..."
auto-resize
:counter="240"
minlength="20"
maxlength="240"
/>
</hw:field>
</hw:field.group>
<hw:field name="context" label="Project context" description="Required, 20 to 240 characters." required>
<hw:rich-text
placeholder="Add additional context..."
auto-resize
minlength="20"
maxlength="240"
/>
</hw:field>
<hw:field.separator />
<hw:field name="terms" :error="false" required class="rounded-lg border p-3">
<div class="flex items-start gap-3">
<hw:checkbox value="1" />
<hw:field.content>
<hw:field.label>Ready for review</hw:field.label>
<hw:field.description>I confirm this project brief is complete enough for the team to review.</hw:field.description>
<hw:field.error />
</hw:field.content>
</div>
</hw:field>
<hw:button type="submit">
<x-lucide-send class="size-4" />
Submit for validation
</hw:button>
</hw:field.set>
</hw:form>
Filter form
Filter results as you type without reloading the page. type="search" includes a clear button and Escape-to-clear; clearing submits immediately. clean-query-params omits empty filters, and frame updates only the results, leaving the address bar unchanged. Each control opts into auto-submit separately.
| Project | Category | Status |
|---|---|---|
| Website redesign | design | active |
| Billing migration | engineering | paused |
| Onboarding revamp | design | paused |
| Incident tooling | ops | active |
{{-- The canonical filter form: GET, auto-submit, clean-query-params, one frame.
Each control opts in individually and picks its own event and timing. --}}
<hw:form
method="get"
:action="route('components.form')"
auto-submit
auto-submit-delay="300"
clean-query-params
frame="form-filter-results"
>
<div class="grid gap-4 sm:grid-cols-3">
<hw:field name="q" label="Search">
<hw:input type="search" placeholder="Filter by name…" auto-submit />
</hw:field>
<hw:field name="category" label="Category">
<hw:select
:options="['design' => 'Design', 'engineering' => 'Engineering', 'ops' => 'Operations']"
placeholder="Any"
auto-submit
/>
</hw:field>
<hw:field name="status" label="Status">
<hw:select
:options="['active' => 'Active', 'paused' => 'Paused']"
placeholder="Any"
auto-submit
/>
</hw:field>
</div>
</hw:form>
<hw:frame id="form-filter-results" class="mt-4 block">
<hw:table>
<hw:table.header>
<hw:table.row>
<hw:table.head>Project</hw:table.head>
<hw:table.head>Category</hw:table.head>
<hw:table.head>Status</hw:table.head>
</hw:table.row>
</hw:table.header>
<hw:table.body>
@forelse ($rows as $row)
<hw:table.row>
<hw:table.cell>{{ $row['name'] }}</hw:table.cell>
<hw:table.cell>{{ $row['category'] }}</hw:table.cell>
<hw:table.cell>{{ $row['status'] }}</hw:table.cell>
</hw:table.row>
@empty
<hw:table.row>
<hw:table.cell colspan="3">No projects match those filters.</hw:table.cell>
</hw:table.row>
@endforelse
</hw:table.body>
</hw:table>
</hw:frame>
The remaining props
ConceptualEvery prop adds one Stimulus controller and they compose on a single data-controller. frame accepts a string or a model — an object resolves through dom_id().
unsaved-changes and error-scroll are already live on the validation
form above: edit a field and try to navigate away, or submit it empty and watch where the page lands.
{{-- Each prop adds one controller; they compose on data-controller --}}
<hw:form auto-submit unsaved-changes error-scroll clean-query-params conditional-fields>
...
</hw:form>
{{-- Submit into a Turbo Frame. An object resolves through dom_id() --}}
<hw:form :action="route('tasks.store')" frame="task-list" />
<hw:form :action="route('tasks.update', $task)" method="put" :frame="$task" />
{{-- Preserve the GET URL that rendered a frame-hosted form, so a failed
validation redirects back to a URL that can render that frame again --}}
<hw:form :action="route('tasks.update', $task)" method="put" track-frame-src />
{{-- File uploads need the native encoding --}}
<hw:form :action="route('documents.store')" method="post" enctype="multipart/form-data" />
{{-- state seeds conditional-field visibility on the first render;
old() wins over it after a failed validation --}}
<hw:form conditional-fields :state="$feedback" />