Modal resize
Is there any way to change the width of the nuxt ui modal? Because I was looking and I can't make it wider and I need it to be wider
5 Replies
Hi @Carlos. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The Nuxt UI Modal component does not provide a direct prop to set a custom width. By default, when not in fullscreen mode, the modal uses a fixed width defined by the class:
This means the modal will be at most
To change the width of the Nuxt UI Modal, override the
max-w-lg
(which is typically 32rem) and will shrink to fit smaller screens. The modal's width is controlled by the theme configuration under the fullscreen: false
variant:
To make the modal wider, you need to override the max-w-lg
part in your theme configuration. For example, in your app.config.ts
:
Here, max-w-3xl
will make the modal significantly wider. You can adjust this value as needed (e.g., max-w-4xl
, max-w-screen-md
, etc.) according to your design requirements.
Summary:To change the width of the Nuxt UI Modal, override the
content
class for the fullscreen: false
variant in your theme configuration and set a larger max-w-*
value see the Modal theme documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@383506538251419649> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai And if I only want to change the width of one modal and not of all?
Let me check the knowledge base for you again. One moment! :books:
----------------------
The knowledge sources do not explicitly mention a built-in way to set a custom width for a single Nuxt UI Modal instance via a prop or slot. The documented approach for changing modal width is through the global theme configuration, which affects all modals see Modal theme.
If you need per-modal customization, the official documentation does not provide a direct solution. You may consider using a custom class or style on the modal content via a slot or by extending the component, but this is not covered in the provided sources. Therefore, based on the available documentation, there is no officially supported way to change the width of only one modal without affecting all modals.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@383506538251419649> Kapa.ai is still learning and improving, please let me know how I did by reacting below.