Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Respect's avatar

wire:click not working in if passed button in slot to layout

Hello friends Thanks for help, wire:click not working in if pass button in slot to layout - but work if i moved out of slot

  • projects.blade.php // livewire component
<div>
    <x-slot name="searchInput">
        <x-inputs.search />
    </x-slot>
    <x-slot name="createBtn">
// NOT WORKING  event not working
        <x-buttons.create name="Create Project" wire:click.prevent="changeValue('from create')" />
    </x-slot>
// EVENT WORKING 100%
        <x-buttons.create name="Create Project" wire:click.prevent="changeValue('from create')" />
</div>
  • Project.php
    public $filter = '';

    public function changeValue($value)
    {
        dd('touched');
        $this->filter = $value;
    }


  • layout.blade.php
0 likes
2 replies
FabioPacifici's avatar

🤔Here for the same issue, apparently this is due to the component isolation that prevents the event propagation when the wire:click is inside the slot. In my case the slot isn't really necessary so i worked around the issue by moving the button outside the slot and removed it.

However, it would be interesting to find out what's actually wrong and how to make it work.

1 like

Please or to participate in this conversation.