UI components

Modal

Basics

To create modal windows, the moonshine::modal component is used.

Content...
Open modal
<x-moonshine::modal title="Title">
<div>
Content...
</div>
<x-slot name="outerHtml">
<x-moonshine::link-button @click.prevent="toggleModal">
Open modal
</x-moonshine::link-button>
</x-slot>
</x-moonshine::modal>

Wide window

The wide parameter allows modal windows to fill the entire width.

Content...
Open wide modal
<x-moonshine::modal wide title="Title">
<div>
Content...
</div>
<x-slot name="outerHtml">
<x-moonshine::link-button @click.prevent="toggleModal">
Open wide modal
</x-moonshine::link-button>
</x-slot>
</x-moonshine::modal>

Automatic width

The auto parameter allows modal windows to take up width based on the content.

Content...
Open auto modal
<x-moonshine::modal auto title="Title">
<div>
Content...
</div>
<x-slot name="outerHtml">
<x-moonshine::link-button @click.prevent="toggleModal">
Open auto modal
</x-moonshine::link-button>
</x-slot>
</x-moonshine::modal>

Closing a window

By default, modal windows close when clicked outside the window area. You can override this behavior using the closeOutside parameter.

Content...
Open modal
<x-moonshine::modal :closeOutside="false" title="Title">
<div>
Content...
</div>
<x-slot name="outerHtml">
<x-moonshine::link-button @click.prevent="toggleModal">
Open modal
</x-moonshine::link-button>
</x-slot>
</x-moonshine::modal>

Asynchronous Content

The moonshine::modal component allows you to load content asynchronously.

Open async modal
<x-moonshine::modal
async
:asyncUrl="route('async')"
title="Title"
>
<x-slot name="outerHtml">
<x-moonshine::link-button @click.prevent="toggleModal">
Open async modal
</x-moonshine::link-button>
</x-slot>
</x-moonshine::modal>