Feedback

Modal

A dialog over the page, built on the native <dialog>: a centered box, a side panel (flyout) or a floating panel, with a title, a close button and focus kept inside while it is open. It opens from a trigger, a keyboard shortcut, JavaScript or the server. tk:modal.confirm is a ready-made "Are you sure?" dialog.

Invite a teammate

They will get an email with a link.

Type an email and press Enter. Invited: —
Blade

Clicking Invite opens a centered white box over a dimmed page, with the title, the subtitle, the form and a close button in the top corner. The focus moves to the title. Escape, the close button or a click on the dimmed backdrop closes it, and the focus returns to Invite.

Opening from the server or from JavaScript #

Inside Livewire, $this->modal($name)->show() and ->close() open and close the modal of that name in this component; $this->modals()->close() closes every open modal. Outside Livewire, TALLKit::modal($name)->show() opens it on the next page rendered: the view this request returns, or the page after a redirect; ->close() undoes a show() of the same request, and TALLKit::modals()->close() drops every modal flashed in it. In JavaScript, tallkit.modal(name).show() and .close(). Inside the modal, Alpine expressions can call show() and close() for the modal they are in (x-on:click="close()").

Blade

Side panel #

A full-height panel that slides in from the right edge (left in right-to-left pages), 25rem wide from md. position also takes left, top and bottom. floating is the same panel with a margin and rounded corners.

Filters

Blade

Asking for confirmation #

The button opens a small dialog asking "Do you really want to delete this record?" with Cancel, focused, and a red Confirm. Confirm calls deleteProject and closes the dialog. The title, subtitle and both buttons can be changed with props and the cancel: and confirm: prefixes.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Project: active
Blade

Keyboard shortcut #

⌘K on macOS, Ctrl+K elsewhere, opens the modal from anywhere on the page. The shortcut is written with Alpine's key modifiers (ctrl.k, cmd.k, slash), plus mod, which is ⌘ on Apple platforms and Ctrl on the others. tk:kbd shortcut="mod.k" shows the same keys to the user. bare removes the box, padding and close button, for content that brings its own look.

Press Ctrl / to open it (⌘K is taken by this site's search).
Blade

Edges and floating #

position puts the flyout panel on any edge: left, right, top or bottom. floating adds a margin and rounded corners.

Filters

Narrow down the order list.

Filters

Narrow down the order list.

Filters

Narrow down the order list.

Filters

Narrow down the order list.

Your cart

3 items, $129.90.

Blade

Sizes and backdrops #

size sets the text sizes, from xs to 3xl. backdrop is strong, subtle, ghost or false.

Release notes

Size sm

Orders can now be exported to CSV.

Release notes

Size lg

Orders can now be exported to CSV.

Release notes

Size 2xl

Orders can now be exported to CSV.

Backdrop

Strong

Backdrop

Subtle

Backdrop

Ghost

Blade

Actions and content #

The modal passes actions, separator, prepend and append to its section; tk:modal.close is a button that closes the modal it is in.

Terms of Service

Last updated on March 1.

By using the service you agree to keep your account details up to date and to pay invoices within 30 days.

Blade

Not dismissible #

:dismissible="false" keeps the modal open on Escape and backdrop clicks; persist does the same and shakes the box.

Choose a plan

Pick a plan to continue, or use the close button.

Unsaved changes

Press Escape or click outside to see the shake.

Blade

A trigger placed elsewhere #

tk:modal.trigger opens the modal with that name, wherever the modal is on the page.

What's new

Orders can now be exported to CSV.

Blade

Confirming per row #

confirm takes the method with its arguments, and title changes the question.

Website redesign

Delete Website redesign?

This action is permanent and cannot be undone. All related data will be lost.

Mobile app

Delete Mobile app?

This action is permanent and cannot be undone. All related data will be lost.

Billing migration

Delete Billing migration?

This action is permanent and cannot be undone. All related data will be lost.

Blade

Events #

opened and closed fire on the dialog with the modal name. Here opened counts in Alpine.

Tracked modal

Opened times, last closed:
Blade

Customization #

Classes go to the <dialog>; prefixed attributes (section:, title:, close:) reach the parts inside.

Styled modal

A wider box with more padding.

Blade

Reference

tk:modal
├── trigger (slot)
├── tk:modal.close
└── content

tk:modal.confirm
tk:modal.trigger
Prop Type Default Description
name string generated The name used to open and close it from JavaScript or the server.
title string | slot null The heading, which names the dialog.
subtitle string | slot null Text under the title, which describes the dialog.
description, prepend, append, actions, content, separator Passed to the inner section: text, content around the title, actions beside it, and a line under it (false by default).
variant string box flyout (a panel along an edge), floating (the same with a margin), bare (no box, padding or close button), or the default centered box.
position string right For flyout and floating: left, right, top or bottom.
size string md xs, sm, md, lg, xl, 2xl or 3xl. Sets the text sizes.
backdrop string | bool dimmed strong (almost black), subtle (light), ghost or false (none).
closable bool true (false with bare) Shows the close button.
dismissible bool true false keeps the modal open on Escape and backdrop clicks; it closes only from a close button or code.
persist bool | string false Like dismissible="false", but shakes the box on Escape or a backdrop click. A string is the CSS class of another animation.
shortcut string null A key combination that opens it, in Alpine's key modifier syntax: mod.k, ctrl.k, cmd.k, slash. mod is ⌘ on Apple platforms and Ctrl elsewhere. A shortcut without mod, ctrl, cmd, meta or alt is ignored while the user types in a field.
trigger slot null The element that opens the modal when clicked.

Slots

Slot Description
default The content.
trigger The element that opens it.
close Replaces the close button.
title, subtitle, actions... As the props of the same name.

Events

Event Detail When
opened { name } The modal opened.
closed { name } The modal closed.

Prefixes

Prefix Goes to
trigger: The element around the trigger.
close: The close button.
section: The section inside the box, with its own prefixes (title:, subtitle:, content:...).
title:, subtitle:, content:, actions:, separator:, list:, container:, icon*, badge* The same parts of the section, written without section:.
Prop Type Default Description
variant string null delete changes the default texts and makes Confirm red.
confirm string null The Livewire method called by Confirm.
cancel string null The Livewire method called by Cancel.
autoClose bool true Closes the dialog when Confirm is clicked. false leaves it open, for the action to close it.
title string Are you sure? The question.
subtitle string Do you really want to proceed with this action? The explanation under it.
actions slot null Replaces the Cancel and Confirm buttons.
size, description, prepend, append As on tk:modal.

Every other attribute goes to the tk:modal (name, shortcut...). The default slot is the trigger.

Slots

Slot Description
default The element that opens it.

Events

Event Detail When
confirmed Confirm was clicked. Bubbles.

Prefixes

Prefix Goes to
actions:, cancel:, confirm: The row of buttons, Cancel and Confirm (confirm:label="Delete").

tk:modal.trigger opens the modal named by name when its content is clicked, and takes a shortcut; use it for a trigger placed away from the modal. tk:modal.close is a tk:button that closes the modal it is in. Any element with data-tallkit-modal-close does the same.

Events

Events are dispatched on the <dialog> and do not bubble: listen on the tag itself.

With Alpine:

blade

Customization

Classes and attributes on the tag go to the <dialog>. To reach the parts, prefix the attribute (listed in the Reference above).

blade

Accessibility

Follows the WAI-ARIA dialog pattern with the native modal <dialog>: the rest of the page is inert while it is open, the dialog is named by its title (aria-labelledby) and described by its subtitle (aria-describedby), and tk:modal.confirm has role="alertdialog". On opening, the focus goes to the element with autofocus, or else to the title; on closing, it returns to the element that opened it, or to the dropdown's trigger when the modal was opened from a menu item that is no longer shown.

Key Action
Tab / Shift+Tab Moves through the controls inside the modal only.
Escape Closes the modal (the innermost one, when modals are nested), unless dismissible is false or persist is set (with persist, the focus stays where it was).

Behavior notes

  • A modal inside another stays on top of it; Escape and clicks close only the innermost.
  • The page does not scroll behind an open modal, and keeps its scrollbar space, so the layout does not jump.
  • The dialog has wire:ignore.self: a Livewire update does not close an open modal.
  • When a Livewire action redirects, the modals opened with $this->modal()->show() in that request, by any component on the page, are flashed instead: the modal with that name on the next page opens when it loads. The same happens when a component redirects from mount(), for its modals and those of the parents still mounting.
  • $this->modal() in a Livewire component targets only the modals that component renders, so two components can use the same name. TALLKit::modal() and tallkit.modal() target every modal with the name.
  • Toasts sent while a modal is open appear under its backdrop and cannot be used until it closes; for feedback inside the modal, use a tk:alert in its content.