#[kapa.ai] How to make modal content wider
5 messages · Page 1 of 1 (latest)
To make modal content wider in a Nuxt (or Vue) project, you generally need to adjust the width-related classes or styles on the modal's container element.
For example, in the context of a modal using Headless UI's Dialog component, you can control the width by modifying the class on the DialogPanel. In the provided example, the width is set using Tailwind CSS classes like w-full and max-w-xl. To make the modal wider, you can increase the max-w-* value:
<DialogPanel
class="pt-5 w-full max-w-3xl overflow-y-auto transform overflow-visible rounded-2xl bg-white dark:bg-slate-800 p-6 align-middle shadow-xl transition-all"
>
<!-- Modal content -->
</DialogPanel>
Here, changing max-w-xl to max-w-3xl will make the modal panel wider. You can use any valid Tailwind width class (e.g., max-w-4xl, max-w-screen-lg) to suit your needs. If you want a custom width, you can also use inline styles or a custom CSS class.
This approach is also applicable to other modal implementations—just target the modal's main container and adjust its width property or class accordingly. For example, in a Vuetify v-dialog, you can use the width prop or apply a custom class with your desired width.
Reference: See the usage of max-w-xl in the DialogPanel example for Headless UI modals in the knowledge source Opening Headless UI Dialog via another Dialog.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@prisma pasture Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Let me check the knowledge base for you again. One moment! :books: