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

Triminio21's avatar

Styles and text error when clicking on a Livewire button

I have an element, specifically a button with the text "Delete" and when I click on it the text to be shown is "Deleting", the problem is that it is a table and when I click on the button, the whole interface moves, I want to eliminate this behavior and I don't know how to do it.

This is my code:

0 likes
1 reply
tykus's avatar

The w-16 utility has not effect on the span element; it would be better moved to the button. Make sure the choice of width is appropriate for the maximum content length (the longest word). I am not sure the text-center utility is necessary either; that should be the default for a button

<button wire:click="eliminarElemento({{$item['producto_id']}})" class="w-16 bg-slate-300 border-2 border-slate-400 rounded-lg px-3 py-1 hover:bg-red-500 hover:text-white hover:border-red-700">
  <span wire:loading.remove wire:target='eliminarElemento({{$item['producto_id']}})'>Eliminar</span>
  <span wire:target="eliminarElemento({{$item['producto_id']}})" wire:loading>Eliminando</span>
</button>

Please or to participate in this conversation.