Skip to main content

Laravel Prompt to Build a Livewire 3 Component

Build interactive Livewire 3 components — real-time search, dynamic forms, infinite scroll, and modal workflows with almost no JavaScript.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt builds a single interactive Livewire 3 component from a clear spec, covering both the PHP class and the Blade view. Rather than producing a skeleton, it asks for the reactive behavior that actually makes Livewire feel responsive: debounced search, loading states, browser-event dispatch, and a paginated list, plus a PHPUnit feature test so the interactivity is protected against regressions.

The variables shape exactly what gets built. [component_purpose] defines the feature, [properties] lists the reactive public properties that drive the UI, and [interaction_type] tells the AI which behavior (filtering, pagination, live updates) needs to happen without a page reload. [validation_approach] controls how form input is checked, [notifications] decides which browser events fire for toasts, and [alpine_feature] specifies where Alpine.js handles purely client-side concerns like dropdowns or modal toggles. Because the prompt pins the debounce at 300ms and demands wire:loading indicators, the result behaves consistently instead of leaving those details to chance.

When to use it

  • Building a live search box that filters results as the user types, without a full page reload
  • Creating a dynamic form that validates fields in real time and shows inline errors
  • Adding a paginated, filterable list (products, users, posts) to a Livewire app
  • Wiring toast notifications driven by server-side success or error events
  • Combining Livewire reactivity with small Alpine.js touches for dropdowns and modals
  • Replacing a JavaScript-heavy widget with a JS-light Livewire equivalent

Example output

You get a Livewire component class with the declared [properties] as public properties, lifecycle and action methods for the interaction, and a Blade view styled with Tailwind that includes wire:loading indicators and pagination links. Alpine.js handles the [alpine_feature] inline. Alongside that sits a PHPUnit feature test exercising the component's main flows — typing into search, asserting filtered results, and checking validation — so you have coverage from the first commit.

Pro tips

  • Make [component_purpose] a full sentence (real-time product search with filters and sorting) so the AI knows what data it's working with
  • List every reactive property in [properties]; anything you omit won't be wired up and you'll add it manually later
  • Match [validation_approach] to your UX — real-time field validation feels nicer but fires more requests than on-submit
  • Keep the 300ms debounce unless your dataset is tiny; lower values hammer the server with queries on every keystroke
  • Use [alpine_feature] only for genuinely client-side state (open/closed toggles); pushing that through Livewire adds needless round-trips
  • Treat the generated PHPUnit test as a baseline and extend it for your edge cases before trusting the component in production

Frequently Asked Questions

Is this prompt for Livewire 3 specifically or older versions?
It targets Livewire 3, which changed several APIs from version 2 including event dispatching and lifecycle hooks. If you are on Livewire 2, the generated wire:loading and dispatch syntax will need adjusting before it runs correctly.
Does the generated component include a test?
Yes, the prompt asks for a PHPUnit feature test covering the component. Treat it as a starting point that exercises the main interactions, and add cases for your own edge conditions before relying on it.
How much JavaScript will I actually need to write?
Very little. Livewire handles the server round-trips and the prompt scopes Alpine.js to small client-only concerns like dropdowns and modal toggles, so most of the interactivity comes from the PHP component and Blade directives.
Why does the prompt fix the debounce at 300ms?
A 300ms debounce balances responsiveness against server load, firing one query after the user pauses typing rather than on every keystroke. You can change it, but going much lower risks a flood of requests on real datasets.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Laravel & PHP Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support