Create a Visualforce Page for the Salesforce Mobile App Using SLDS
Let’s create a Visualforce page that displays your recently accessed accounts and is styled with the Lightning Design System (SLDS) and add it to the mobile navigation menu.
-
First, let’s create the Visualforce page.
-
Open the Developer Console and click File | New | Visualforce Page. Enter
SLDSPagefor the page name. -
In the editor, replace any markup with the following.
- The
<apex:slds />tag allows you to access SLDS stylesheets. This component is an easy alternative to uploading SLDS as a static resource and using it in your Visualforce pages. - The
<div class="slds-scope">wrapper is necessary around any SLDS-styled content. SLDS styles only apply to elements contained inside of it.
- The
-
This page is also mobile-friendly. Let’s add the page to the Salesforce mobile menu.
-
Enable the page for mobile apps.
-
From Setup, enter
Visualforce Pagesin the Quick Find box, then select Visualforce Pages. -
Click Edit next to the
SLDSPageVisualforce page in the list. -
Select Available for Lightning Experience, Experience Builder sites, and the mobile app.
-
Click Save.
-
-
Create a tab for the Visualforce page.
-
From Setup, enter
Tabsin the Quick Find box, then select Tabs. -
In the Visualforce Tabs section, click New.
-
In the Visualforce Page drop-down list, select SLDSPage.
-
In the Tab Label field, enter
SLDS Page.Notice that the Tab Name field is filled in automatically
-
Click in the Tab Style field and select the Diamond style.
The icon for this style appears as the icon for the page in the Salesforce mobile navigation menu.
-
Click Next, then Next, then Save.
-
-
Add the tab to the mobile navigation menu.
-
From Setup, enter
Mobile Appsin the Quick Find box, then select Salesforce Navigation. -
Select the SLDS Page tab and click Add.
The SLDS item is added at the bottom of the Selected list.
-
Click Save.
-
