Announcing the Global SNUG Board of Directors. Learn more here
on 05-13-2021 11:20 AM - edited on 09-13-2023 01:45 PM by MGOPW
Center of Excellence / UI Builder / UI Builder Quick Start Guide / Building a Page |
Working with Layouts |
Layouts control how containers and components are organized on a page. An updated layout system was introduced in the San Diego release that provides for better performance and simplifies page customization. The new layout system allows users to configure CSS Flexbox or Grid layouts without editing code as well as using slots unlike the legacy layout system. The new layout system features a simplified content tree and a new styling panel for layout configuration and component styling.
Existing and custom pages may still utilize the legacy layout system, and can be upgraded to the new layout system using the built-in upgrade wizard. All new pages will use the new layout system once the instance has been upgraded to San Diego or later. Page developers are encouraged to test the layout migration in a sub-production instance and perform any necessary testing or changes as needed.
When using the upgrade wizard, no components, data resources, events, styling, etc. will be impacted, only the layout of the page itself. Some of the changes that will be made:
Visit the Upgrading layouts in UI Builder product documentation for more information the features of the new layout system and detailed information on what to look for after upgrading to a new layout.
If you're still using the legacy layout system, see the Layouts in UI Builder product documentation and the UIB Quick Start Guide video for Quebec.
Layout Systems |
Flexbox is a one-dimensional layout system in CSS. Flexbox is inherently flexible, which is perfect for when you do not know the size of your content. You can change the direction of your content in the layout in the following ways.
See the Using Flexbox layouts in UI builder product documentation for instructions on how to use Flexbox for both the legacy and new layout system.
CSS grid is the most powerful layout system in CSS. CSS Grid is built on top of a two-dimensional grid. CSS Grid gives you power over how you create your pages.
For example, you can have a grid with three columns and nine cells. Five slots are built on top of the grid. The header slot spans three columns and three cells. A footer slot also spans three columns and cells. And three slots exist in the middle columns, with the middle slot larger than the left and right slots.
To find out more about CSS grid layouts within your UI Builder instance, you can find them in the sys_uib_template table.
See the Using CSS Grid layouts in UI builder product documentation for instructions on how to use Grid for both the legacy and new layout system.
Working with Components |
Please visit the Next Experience® Components Library on the ServiceNow Developers site to explore further.
Tip: When creating containers or components on a duplicated page or a page that is using a page template, give your components a naming scheme that is unique to your instance. For example, when creating scripts or variables, organizations usually provide some type of naming scheme to denote it is a custom script and not out of the box. If your company acronym or naming scheme for other parts of the instance is 'abc' you can provide the component id such as abc_open_task_single_score. Also ensure you are giving your components a label that helps developers navigate through the content tree. For example the label for the example above can be ABC Open Task Single Score or just Open Task Single Score. Labeling and naming components is considered best practice even when using custom pages. |
After creating a page or variant, start with setting the layout for the page. Using the new layout system in San Diego, either Flexbox or Grid can be chosen. After selecting a layout for the page, add containers to the page and configure the layout for each container. You can set the layout to Flexbox or Grid at the container level.
1. Select the Body of your page in the content tree to the left of the main page area. The content tree is a graphical look at how your page construction. Body is the top page-level. This can either be set to Flexbox or Grid using the new layout system.
2. Click the + symbol to add a container to the page. Configure the layout as needed in the container, in this example Flexbox is used.
3. To add a component either click the + sign in the container, or in the content tree click on the three vertical dots and select Add component after.
4. To add another component to the row either click the + sign next to the first component, or in the content tree click on the three vertical dots to the left of the first component and select Add component after.
5. Select Save often as you work.
6. Select Open to see a preview of what it looks like as a web page.
Add Styling to a Component |
Set CSS styles for a component to change its default appearance. The layout system in San Diego exposed many CSS properties that were previously configured by adding CSS code. If you're using the legacy layout system see the Add styling to a component using the old layout system.
1. Select a component or the container holding the component that you want to add styling to in the Content panel.
2. Select the Styles tab in the configuration panel.
3. In the Styles tab you can change the following CSS Properties, in San Diego these properties have been linked to theme the experience is using, or admins can choose their own properties.
4. Alternatively, you can edit the CSS by clicking the View and edit CSS link at the bottom of the Styles tab. For more information on the CSS properties that can be used see the Add styling to a component product documentation.
5. In the main header, select Save to save your changes.Add styling to a component in the Main Styles configuration panel.
Working with Variants |
A page variant is based on your page with content targeted for a different audience. For example, you can create a homepage for agents, and a variant of that page for managers of those agents. The variant exists at the same URL.
Working with Viewports |
Viewports are specialized components that enable you to extend your experience without needing to own the parent page in Next® Experience UI Builder. You can work with viewports in three ways:
1. Use a viewport component
2. Use a viewport-enabled tab
3. Add a viewport to the Contextual Sidebar component
Add a viewport component to your page to create separate content even if you do not own the content of the page itself. You can create subpages, specify audiences, or customize content with different data, routes, and screens. For more information about viewport components, see Viewport component.
Tab components can be replaced with Viewport-enabled tabs as a way to display third-party custom data, assign audiences, and create variants. For more information about viewport-enabled tabs, see Replace a tab with a viewport-enabled tab.
For more detail on viewports see the Work with viewports product documentation.
Add a viewport to your page
Adding a viewport to your page lets you create separate content that is viewed when you click a tab on your page. You create tabs within a component. Then, within those tabs, you can create custom pages or even third-party custom user interfaces. Follow the steps below to add a viewport to your page.
Working with Modals |
Use modals in Next® Experience UI Builder with components to provide alerts or calls to action for a user. UI Builder comes with modals to save time and effort.
A modal window disables the main page in UI Builder. A modal keeps the page visible with the modal window displayed in front of it. Users must interact with the modal before they can return to the main UI Builder page.
UI Builder has preconfigured modals available. You can add a modal to your component. Then, configure the content of the modal, and how it displays on the screen. Add an event handler to the modal to perform an action when a user selects it. The action can alert a user about something, or ask a user to confirm an action. A modal is a way to ensure that a user knows what is happening. For example, a modal may ask a user to confirm a selection before continuing whatever action they are performing on the main page.
Modal |
Description |
Alert | An Alert modal provides information relating to the component action. For example, when a user presses a delete button, you could have an alert pop-up that lets the user know they cannot undo a delete action. |
Confirm | A Confirm modal asks a user to confirm the component action. For example, when a user presses a delete button, the user would have to confirm the deletion of data. You can choose the confirm options from the primary and secondary button label fields, such as Yes/Cancel. |
Confirm and destroy | A Confirm and destroy modal is more directive, usually relating to deleting or erasing content. It lets the user know the seriousness of an action, and asks them whether they want to proceed with the action. |
Custom | Custom modals address scenarios that are not handled using the standard modals. Custom modals can be thought of as a container component on a modal. You can add a custom layout, components, events, and data resources just like you do on a page. The custom modal uses layouts to let you fully design what information you want in the modal. Layouts also decide where the information sits within the modal screen. You can use Cascading Style Sheets (CSS) styling to change the visual look of the modal. |
iframe | Use iframe to bring content into your modal from existing iframe content from a URL and data. |
Modal Viewport | Dynamically pass content into your viewport modal through an event binding using a client script. |
Expose events to modals to handle call-to-action events. For example, a primary action, secondary action, and so on. You configure the data by adding an event handler and invoking a data resource. It is as simple as adding a new event handler for the component that has a modal. Or you can add an event handler to the modal itself. You select the event you want associated with the component or modal and add it. See Add modal to component for detailed instructions.
Preview a Page in UI Builder |
When you create or edit a page in UI Builder, you can open it as a preview to see what the page will look like as a web page. This is a great way to see how your page looks as you build it.
For example, if you add a Delete record button that opens a modal asking a user to confirm the deletion, you may want to open the page in runtime to ensure that the button and modal are displayed the way you want them to. To preview a page, first save your page, then select the Open button to the right of the URL field.
Your page will open as a web page. You can test your page as if it was live on a site. Click the components that you added to ensure they work as expected, check that the data resources are available, the layouts are set up correctly, and so on.
Previewing a page in UI Builder is a powerful tool to help you test your pages.
Hi Ashley - Thank you for these really valuable resources.
I'm really liking UI Builder and it's a massive help to me when building complex pages.
I'd like to make two suggestions for improvements:
It would make a huge difference to the interface it would be the ability to drag & drop containers and components from within the Content Tree itself. I've been doing this on the Stage panel but have experienced lots of frustration where the "drop target" isn't correct and a page gets mangled.
If that's a long-term proposition, it would be great if there was an "undo" mechanism for the most recent action - so I could avoid the mangled pages !
I'd really like to stress that these comments are intended as constructive feedback -I'm not sure if this is the right place to make these suggestions and apologise in advance if there's amore appropriate place.
Many thanks - appreciate all your great work, Ashley!
Andy
No undo either.
Hi Ashley - Thank you for these really valuable resources.
I'm really liking UI Builder and it's a massive help to me when building complex pages.
I'd like to make two suggestions for improvements:
It would make a huge difference to the interface it would be the ability to drag & drop containers and components from within the Content Tree itself. I've been doing this on the Stage panel but have experienced lots of frustration where the "drop target" isn't correct and a page gets mangled.
If that's a long-term proposition, it would be great if there was an "undo" mechanism for the most recent action - so I could avoid the mangled pages !
I'd really like to stress that these comments are intended as constructive feedback -I'm not sure if this is the right place to make these suggestions and apologise in advance if there's amore appropriate place.
Thank you for your excellent content, Ashley.
Much appreciated
Andy
Hi Ashley - Thank you for these really valuable resources.
I'm really liking UI Builder and it's a massive help to me when building complex pages.
I'd like to make two suggestions for improvements:
1) It would make a huge difference to the interface if we had the ability to drag & drop containers and components from within the Content Tree itself. I've been doing this on the Stage panel but have experienced lots of frustration where the "drop target" isn't correct and a page gets mangled.
2) If that's a long-term proposition, it would be great if there was an "undo" mechanism for the most recent "move" action - so I could avoid the mangled pages !
I'd really like to stress that these comments are intended as constructive feedback - I'm not sure if this is the right place to make these suggestions and apologise in advance if there's amore appropriate place.
Thank you for your excellent content, Ashley.
Much appreciated
Andy
Hey Andy, thanks for the feedback! The best place to leave feedback is on the idea portal (although we're also fine with replies to articles).
For this specific feedback, lets just say you'll want to pay attention when the Tokyo release comes out 😉