Skip to content
v2 (Beta) — You are viewing the v2 beta documentation. Switch to v0 (Stable) →

Styling

A fair bit of styling can be adjusted using the configuration options. However, you may want to customize the modal even further using CSS. The components use Tailwind CSS classes, but all major elements have their own class names, so you can easily target them with your own styles.

Available Classes

You're probably the fastest if you just inspect the modal in your browser and see which classes are used. To give you a head start, here are the classes that are used: all classes are prefixed with im- to avoid conflicts with other classes.

ClassDescription
im-dialogThe dialog element (native <dialog> or <div> based on config)
im-close-buttonThe close button
im-backdropThe backdrop behind the modal (only rendered when useNativeDialog is false)
im-modal-containerThe screen-filling container for the modal
im-modal-positionerThe container that positions the modal vertically
im-modal-wrapperThe container that sets the maximum width of the modal
im-modal-contentThe actual modal content
im-slideover-containerThe screen-filling container for the slideover
im-slideover-positionerThe container that positions the slideover vertically
im-slideover-wrapperThe container that sets the maximum width of the slideover
im-slideover-contentThe actual slideover content

Native Dialog Backdrop

When using the native dialog (useNativeDialog: true, which is the default), the backdrop is rendered using the ::backdrop pseudo-element. You can style it using CSS:

css
dialog.im-dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

Note that Tailwind CSS cannot target the ::backdrop pseudo-element, so you'll need to use regular CSS for this. The default backdrop has a semi-transparent dark background with a blur effect.