Media Library Modal Dimensions
This module allows you to customize the width and height of the Media Library modal for each individual field. This lets you optimize the modal's size to better fit the content it displays, such as wider modals for image galleries or taller ones for video browsers. These settings are conveniently available through the existing widget configuration options.
Media Library Modal Dimensions adds width and height settings to every Media Library widget so the modal dialog can be sized to the content it displays — per field, without custom JavaScript or global theme overrides.
Some Media Library fields benefit from a wider or taller picker (image galleries, video browsers) while others are fine at the core defaults. This module lets each field pick its own.
Features
- Per-field control of the Media Library modal's width and height.
- Settings exposed through Drupal core's existing widget settings UI — no new admin pages, no custom routes, no permissions to manage.
- Accepts percentages and pixel sizes (integer or decimal) plus
auto - Forward-compatible wrapper pattern that survives expected core refactors of
MediaLibraryWidget(see core issue #3127867). - Works with any field on any entity type that uses the Media Library widget — content types, paragraphs, custom entities.
Installation
Install as you would normally install a contributed Drupal module. No additional configuration step is required after enabling — the new settings appear automatically on every Media Library widget.
Configuration
- Go to Structure → Content types → [your content type] → Manage form display (or the equivalent screen for any entity that uses a Media Library widget).
- Click the gear icon next to a field that uses the Media library widget.
- Set Media Library dialog width and/or Media Library dialog height to one of:
- A percentage — for example
75%or95% - A pixel size — for example
900pxor1200px auto
- A percentage — for example
- Click Update, then save the form display.
Leave either field empty to keep Drupal core's default of 75%.