Menu
Guides
API Reference

Guides

Media gallery

Declare the media-gallery widget in a component schema so editors can pick images and reference videos from the CMS Media Gallery.

1 min read

The Media Gallery is the CMS's central repository for images and video references. As a developer, you expose it to editors by using the media-gallery widget on a field in your component schema.

Supported media

Media typeSupported formats or sources
ImagesPNG, JPG, JPEG, GIF, SVG, and WebP
VideosReferenced by URL from YouTube, Vimeo, and other video hosting services (not uploaded directly)

Declaring the widget in a schema

To let editors pick an image from the Media Gallery for a given field, use the media-gallery widget:


_13
{
_13
"src": {
_13
"type": "string",
_13
"title": "Image",
_13
"widget": {
_13
"ui:widget": "media-gallery",
_13
"restrictMediaTypes": {
_13
"video": true,
_13
"image": ["png", "jpg", "jpeg", "webp"]
_13
}
_13
}
_13
}
_13
}

The restrictMediaTypes property lets you limit which formats editors can pick for that specific field, for example, allowing video references but only a subset of image formats.

For how editors upload, organize, and reuse assets in the Admin, see the Help Center's Media overview.

Next steps

Understanding components and sections
Learn how components declare fields, including media fields, that editors complete in the Admin.
Creating and publishing content
Find the Help Center resources for creating, previewing, and publishing content.