How to create a mobile theme in Jitterbit App Builder
App Builder does a great job of automatically converting any app to be mobile friendly. That said, there may be instances where you want more granular control over the mobile presentation of an app. Like how standard Themes work in App Builder, a Mobile Theme can be applied site wide or more specifically to a page in an app. This article will provide information on how Mobile Themes work in App Builder as well as step through the basic configuration for creating a Mobile theme for an app.
How mobile themes work in App Builder
- Mobile themes are themes that get called in when App Builder detects you are using a mobile device (note they apply to mobile only - not iPad or tablet devices).
- Mobile themes are set up in the same way as standard themes - most notably they have a Base theme, and the Base theme is what determines when and where a Mobile theme gets called and applied. A Mobile theme must have a Base theme to work, and wherever that Base theme is used (either as an application wide theme or just a specific page level theme), the Mobile theme will be called in addition.
- Mobile themes get applied "on top" of other pre-existing themes, they don't replace them, so in order for any styles from a Mobile theme to be applied, they need to be more specific than any pre-existing styles that are getting applied from other themes already on the page.
Note
See the W3 Schools article on CSS Specificity for more information on the order in which CSS gets applied.
Site wide mobile themes
An app named "Budget Calculator" has its Base theme set as "App Base Theme", meaning that theme applies across the entire application. In addition, there is a Mobile theme called "Mobile Theme" - and the Base theme for this mobile theme is set as the "App Base Theme". In this scenario, the Mobile theme will be active across the entire application, as every page uses the "App Base Theme".
Page specific mobile themes
An app named "Budget Calculator" has a page called "Home", which has a page-level theme applied called "Home Page Theme" - meaning this theme only applies on the "Home" page. In addition, there is a Mobile theme called "Home Page Mobile Theme" - and the Base theme for this Mobile theme is set as the "Home Page Theme". In this scenario, the Mobile theme will only be active on the "Home" page of the application, as it only gets called in on pages that use the "Home Page Theme", which in this case is only the "Home" page.
How to create a mobile theme
An example of when you may want to use a Mobile theme is to add padding to outer containers on mobile so that all the app pages have a bit more space to breathe.
Step 1: Create a mobile theme
When you're ready to create a Mobile theme for an app, we will assume that you have an existing app theme already configured. This app theme should be used as the Base Theme for your Mobile theme.
- Navigate to Look & Feel for your app
- Select Mobile from Theme Type
- Click the +Theme button
- Assign a Theme Name. For example: Theme Mobile
- Set the Base Theme value to the main Theme the app is using. For example: Themes Exercise
- Confirm or set the Collection to a Collection your app has access to. For example: NorthwindsTraining
- Set the Type to Mobile
- Click Save
-
Add any mobile specific Style(s) needed. For example:
- Select Panel as Component
- Click + Style from Styles panel
- Set Area to Container
- Set Style Type to Spacing
- Under Values, set 3-Padding to the desired setting. For example: 2em
- Click Save
Step 2: Associate mobile theme to app
In this step you will associate the Mobile theme to the app. For this example we want the Mobile theme to appear site wide, so we will confirm that the Base theme is the theme associated with our app.
- Navigate to the App Workbench
- Under App Settings, check that the Theme value is set to the Base theme used by your Mobile theme created in Step 1
- Return to the application view, refresh the web browser and test
Note
Additional Mobile Settings are available for configuration from App Workbench > More > Edge Case.