I am trying to create a custom dropdown to change the icon of a button with alpinejs since I can't have icons or styling with the default select and options html
This is the livewire code to update icon
public function updateTagIcon($id,$value)
{
$this->icon = $value;
$this->validate([
'icon' => 'required',
]);
$this->tag->update(['icon' => $this->icon]);
$this->tag=Tag::find($this->tag->id);
}
Is there a way I can do @click with alpineJS to set $value=1 and pass that to livewire?
Or maybe there is a way to arbitrarly set this data with wire:click?
<div wire:click="updateTagIcon({{$tag->id}},'{{$value=2}}')">
<button type="button">
<svg> //</svg>
{{$tag->title}}
</button>
</div>
Was thinking maybe to emit an event with alpine @click but still not sure how I would pass a value to update the $icon in livewire

x-on:click="$wire.updateTagIcon(2, 1);which would effectively be the same aswire:click="updateTagIcon(2, 1). - Qirel1, that you pass as the second paramteter. How would I identify that in livewire backend in the function as$this->icon = 1- Jakubwire:click="updateTagIcon({{$tag->id}},{{$icon->'5'}})"- Jakub