Component Card

With this card type, card developers can display a whole UI5 Component as content for the card. The card will load the specified component and display it in the card content area. This allows great flexibility and as such, the developer is responsible to follow the guidelines to achieve consistent user experience.

Usage

Component Card Declaration

Like cards, UI5 Components are also described by manifest file. When making a card, the same manifest is shared by the card and the component. The following mandatory properties has to be set on top of the component manifest:

Component lifecycle and API

Properties

The Component Card allows configuration of the content.

Property Type Required Description Schema Version Since
minHeight sap.ui.core.CSSSize No Defines the minimum height of the content. 1.29.0 1.85

Component Preload

For production environments all the resources of the card should be packed into one single file called Component-preload.js. For instructions how to build it read Component Preload.

Example

Create the manifest file. It is the same for the card and the component

{
	"sap.app": {
		"id": "my.component.sample.cardContent",
		"type": "card",
		"applicationVersion": {
			"version": "1.0.0"
		}
	},
	"sap.card": {
		"type": "Component",
		"header": {
			"title": "Visit our workshop"
		}
	},
	"sap.ui5": {
		"rootView": {
			"viewName": "my.component.sample.cardContent.View",
			"type": "XML",
			"async": true,
			"id": "app"
		}
	}
}

Create the Component.js file

sap.ui.define([
	"sap/ui/core/UIComponent"
], function (UIComponent) {
	"use strict";

	return UIComponent.extend("my.component.sample.cardContent.Component");
});

Create the root view

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
	<Image src="..."></Image>
</mvc:View>

Display the card in your application:

<mvc:View xmlns:w="sap.ui.integration.widgets">
	<w:Card manifest="./manifest.json" width="400px" height="auto" />
</mvc:View>
Try it Out