Customize the sidebar

This procedure shows you how to change the colors and the width of the sidebar. It involves setting theme variables.

About this task

If more than one application is open, the sidebar sits along the left-hand side of the application interface and lists all open applications. It provides a means of navigation for the end-user (see Figure 1). You can use the arrow at the bottom to expand the size of the sidebar.

Figure: Application with default sidebar


The following theme variables can be used to change the appearance of the sidebar:

Theme variable Description Default value
theme-sidebar-color The text color of the items and icons. theme-primary-color
theme-sidebar-background-color The background color. palette-secondary-700
theme-sidebar-default-width The default display size in pixels. 56px
theme-sidebar-max-width The expanded size in pixels. 156px

Before you begin

This procedure assumes you are comfortable updating theme parts and themes. For the basic principles behind themes and theme parts, see How customization works. For instructions about adding and modifying themes and theme parts, see Working with themes. For information about the underlying GBC infrastructure and its components, see Theme reference.

  1. Identify the theme part you plan to update. If you are creating a new theme part, prepare the directory.
  2. In the theme part, open the theme.scss.json file in a text editor.
  3. To change the sidebar colors, set the theme-sidebar-background-color and theme-sidebar-color variables. For example:
    // in theme.scss.json
    {
      ...
     "theme-sidebar-background-color" : "$mt-indigo-100",
     "theme-sidebar-color" : "Black",
      ...
    }

    $mt-indigo-100 is a material color constant; see Themes and colors for more details.

  4. To change the sidebar width, set the theme-sidebar-default-width and theme-sidebar-max-width variables. For example:
    // in theme.scss.json
    {
      ...
      "theme-sidebar-default-width" : "100px",
      "theme-sidebar-max-width" : "200px",
      ...
    }
    Note:

    You can hide the sidebar by setting theme-sidebar-default-width to 0. However, this will prevent you from easily accessing the other open applications.

  5. If you created a new theme part, add it to one or more themes.
  6. Save your changes and rebuild your customization using gbc build:
    $ gbc build --customization customization-project-dir
  7. Test that your changes work as expected.

    Open your application and check whether the sidebar displays as expected.

    Figure: Application with customized sidebar


    Tip:

    You may need to use CTRL + F5 to clear the browser cache before you see your changes.

    If your tests do not behave as expected, ensure you are using your newly-built custom GBC. Depending on your development environment, you may need to package and deploy a custom GBC client. For information on which customization and theme you are using, see Selecting customizations and themes.