GitHub

Dialogs

A dialog the server opens: a DialogResponse built in PHP, a Blade view or a React component, also several of them stacked on each other. Every dialog behaves the same by default, and each behavior can be changed per dialog. See Dialogs in the docs.
  • setTitle / setBody / setFooter

    The parts of a dialog; a button with data-dismiss="modal" closes it.

  • setDialog

    The whole content of a dialog, e.g. a Blade view.

  • setController

    A JavaScript class created with the dialog, for its events (show, shown, hide, hidden) or logic.

  • closeDialog / closeDialogs

    Close the most recent dialog, or all of them.

  • setBackdrop / setKeyboard

    'static' for a backdrop that doesn't close the dialog, false for Esc that doesn't.

  • setHideOnSuccess

    Close the dialog when a request sent from inside of it succeeds.

  • setAutoFocus / setTrapFocus / setRefocus

    Focus the dialog when shown, keep Tab inside, give the focus back when closed. All on by default.

  • setAnimate / setPosition / setTimeout

    Fade in and out, the top margin or centered, show after a delay.

Controller.php
namespace App\Http\Controllers;

use App\Arch\BigPipe\DialogResponse;

class DialogController extends Controller
{
    public function showModal()
    {
        return (new DialogResponse())
            ->setTitle('Dialog title')
            ->setBody('HTML body')
            ->setFooter('HTML footer')
            ->dialog()
            ->send();

        // or the whole content of the dialog

        return (new DialogResponse())
            ->setDialog('HTML content')
            ->dialog()
            ->send();
    }

    public function showStaticModal()
    {
        // each behavior can be changed per dialog
        return (new DialogResponse())
            ->setTitle('Static backdrop')
            ->setBody('HTML body')
            ->setBackdrop('static')  // the backdrop doesn't close it
            ->setKeyboard(false)     // neither does Esc
            ->setHideOnSuccess()     // a request from inside does
            ->setPosition(centered: true)
            ->dialog()
            ->send();
    }
}
Try it