MediaGallery
The ui5-media-gallery
component allows the user to browse through multimedia items. Currently,
the supported items are images and videos. The items should be defined using the ui5-media-gallery-item
component.
The items are initially displayed as thumbnails. When the user selects a thumbnail, the corresponding item is displayed in larger size.
The component is responsive by default and adjusts the position of the menu with respect to viewport size, but the application is able to further customize the layout via the provided API.
Keyboard Handling​
The ui5-media-gallery
provides advanced keyboard handling.
When the thumbnails menu is focused the following keyboard shortcuts allow the user to navigate through the thumbnail items:
- [Up] or [Down] - Navigates up and down the items
- [Home] - Navigates to first item
- [End] - Navigates to the last item
- [Space], [Enter] - Selects an item
ES6 Module Import​
import "@ui5/webcomponents-fiori/dist/MediaGallery.js";
import "@ui5/webcomponents-fiori/dist/MediaGalleryItem.js";
Basic Sample​
Properties​
showAllThumbnails​
interactiveDisplayArea​
layout​
menuHorizontalAlign​
menuVerticalAlign​
Slots​
default​
Events​
selection-change​
overflow-click​
display-area-click​
Methods​
No methods available for this component.
CSS Parts​
No CSS parts available for this component.
More Samples​
Vertical Layout​
The thumbnails and selected item are vertically placed. To enable this layout - set layout="Vertical".
Horizontal Layout​
The thumbnails and selected item are vertically placed. To enable this layout - set layout="Horizontal". Furthermore, you can also define on which side of the selected item you preffer to place the thumnails. For instance, setting menu-horizontal-align="Right" will place the thumbnails on the rigtht.
Custom Thumbnail​
By default the image, passed to the MediaGalleryItem, is reused as a thumbnail that the user clicks. However, you can display another image as thumbnail via the thumbnail slot of the MediaGalleryItem.
Selected Item​
You can predefine the selected item.
Disabled Item​
The MediaGallery can show diasbled items as well. In this sample, the first item is disabled and second is shown.
Interactive Display Area​
Setting interactiveDisplayArea property makes the diplay area (where the media content is displayed) interactive, e.g. clickable. In the sample, clicking on the diplay area fires an event, and in this case we show a dialog, but the application can do whatever suitable in the given scenario.