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

zbora23's avatar

How do I pass HTML to Livewire component

Hi all,

Here is my issue, I am designing a custom navigation, and need to put a lot of custom HTML for each drop down item.

<livewire:drop-down-menu-item :selected="$selectedTab" title="Women" slug="women">
    <div class="grid">........... LOADS OF HTML....... </div>
</livewire:drop-down-menu-item>

Inside my component I would expect something like this

<div>
    {{ $slot }}
</div>

Can anyone assist ?

0 likes
1 reply
MohamedTammam's avatar

Livewire components doesn't support slots.

I would suggest that you define your HTML in a blade component and then call it from Livewire.

LivewireComponent.php

<div>
...
<x-your-blade-component />
...
</div>

Please or to participate in this conversation.