Improving the modal (auto positioning, sizes, (quick) actions) #1405
Unanswered
mauritskorse
asked this question in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be great if the modals could get some more functionality just like the new components get quite some extra features out of the box. I have already created my custom modal for this, but native support would be awesome :)
(Quick) actions
Just like the new callout component it would be great if modals will have a slot for
actions
as well asquick actions
. I.e. a slot for normal buttons at the bottom and a slot for adding quick actions positioned next to the close button. Common buttons I add there are a grow/shrink toggle and bookmark/save.Auto positioning
For a custom tooltip component I already implemented auto positioning depending on wether you're on a mobile device or on a desktop (#1069). For that to work I hacked a bit into the core javascript. But for modals this could be quite a bit easier, especially now tailwind v4 supports
max-md
selector out of the box. It does however conflict a bit with the current way variants and position are defined. Hence, in my custom implemenation I scrapped theflyout
variant and only have positioning:center
,bottom
,left
and auto.Bottom
andleft
are flyouts automatically..In
auto
mode the modal shows centered on desktop, and on mobile it is either positioned at the bottom or left at the screen depending on portrait or landscape mode of the device.Screen.Recording.2025-03-26.215245.mp4
Sizes
On many modals I start by adding some size properties. Especially if its content is a new livewire form component for which you would like to keep the width and height consistent while editing/adjusting things in that form. Otherwise you can get jumpy modals as they shrink or grow to be able to fit the content. Setting sizes helps to keep the modal at ease ;)
Below is my custom blade for positioning and sizes:
Beta Was this translation helpful? Give feedback.
All reactions