Mahmoud Al-HabashOpen to new projects
  • WorkWork
  • ServicesServices
  • LabLab
  • WritingWriting
  • ContactContact
Amman--:--عربي
Writing/Laravel

Livewire $wire Object in JavaScript

Access Livewire component methods and properties from JavaScript.

16 January 20261 min readLaravelاقرأ بالعربية

On this page

  1. Call Methods
  2. Get Properties
  3. Set Properties
  4. Call with Return
  5. From Alpine

Access Livewire from JS:

Call Methods

blade
<button onclick="$wire.save()">Save</button>

Get Properties

let name = $wire.name;
let count = $wire.get('items.count');

Set Properties

$wire.set('name', 'John');
$wire.name = 'John';

Call with Return

let result = await $wire.calculate();
console.log(result);

From Alpine

blade
<div x-data @click="$wire.toggle()">
    Click me
</div>
All articles

Keep reading

  • Laravel Action Classes Pattern16 January 20261 min read
  • Laravel Action Classes: Single Responsibility16 January 20261 min read
  • Laravel API Rate Limiting16 January 20261 min read