Livewire

Modal Dialogs with Livewire v4 Teleport

February 01, 2026 1 min read 13 views

Teleport renders content outside the component DOM.

Modal Component



@teleport('body')
    @if($show)
        
    @endif
@endteleport

Component Class

class ModalDialog extends Component
{
    public bool $show = false;
    
    public function openModal(): void
    {
        $this->show = true;
    }
    
    public function closeModal(): void
    {
        $this->show = false;
    }
}
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!