Skip to content

Latest commit

 

History

History
76 lines (49 loc) · 2.39 KB

step-12-shell-control-as-container-typescript-4af44cb.md

File metadata and controls

76 lines (49 loc) · 2.39 KB

Step 12: Shell Control as Container (TypeScript)

Now we use a shell control as container for our app and use it as our new root element. The shell takes care of visual adaptation of the application to the device's screen size by introducing a so-called letterbox on desktop screens.

Preview

The app is now run in a shell that limits the app width

The graphic has an explanatory text.

You can view all files at OpenUI5 TypeScript Walkthrough - Step 12: Shell Control as Container and download the solution as a zip file.

In our app view, we put the App control inside an sap/m/Shell control.

<mvc:View
	controllerName="ui5.walkthrough.controller.App"
	xmlns="sap.m"
	xmlns:mvc="sap.ui.core.mvc"
	displayBlock="true">
	<Shell>
		<App>
			<pages>
				<Page title="{i18n>homePageTitle}">
					<content>
						<Panel
							headerText="{i18n>helloPanelTitle}">
							<content>
								<Button
									text="{i18n>showHelloButtonText}"
									press=".onShowHello"/>
								<Input
									value="{/recipient/name}"
									description="Hello {/recipient/name}"
									valueLiveUpdate="true"
									width="60%"/>
							</content>
						</Panel>
					</content>
				</Page>
			</pages>
		</App>
	</Shell>
</mvc:View>

The Shell control is now the outermost control of our app and automatically displays a so-called letterbox if the screen size is larger than a certain width.

Note:

We don't add the Shell control to the declarative UI definition in the XML view if apps run in an external shell, like the SAP Fiori launchpad that already has a shell around the component UI.

There are further options to customize the shell, like setting a custom background image or color and setting a custom logo. Check the related API reference for more details.

Related Information

API Reference: sap.m.Shell