October 23, 2024
Chicago 12, Melborne City, USA
PHP

Passing html to livewire custom component and modify it


I have a class-based volt component that shows a button and when the button is clicked it opens a modal. So far so good.

I would like to pass the button html when calling the component as a "slot" in order to let the user create their own custom button.

What im trying to do is just this:

<livewire:components.search-user>
    <button>Click me</button>
</livewire:components.search-user>

and in the component capture this html <button>Click me</button> and wrap it up in a div of my own to then display it.

Is this possible?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video