Free cookie consent management tool by TermsFeed

Tab Layout

On This Page
SAIL Design System guidance available for Tab Layout

When you need to organize content into easily navigable sections, use the tab layout.

About the tab layout

Displays content organized into a set of selectable tabs.

See When to use a tab layout for guidance on when to use this component versus a form layout.

overview of tab layout with annotations

Where to use the tab layout

Use a!tabLayout() in the following components:

You can't use a!tabLayout() in a read-only grid (a!gridField()), editable grid (a!gridLayout()), or side by side layout.

Supported components

The tabs parameter supports a list of a!tabItem().

Parameters

a!tabLayout( tabs, showWhen, marginAbove, marginBelow, highlightColor, contentsPadding, selectedTab, selectedTabSaveInto )

Name Keyword Types Description

Tabs

tabs

Any Type

Tabs to display, configured as a list of a!tabItem().

Show When

showWhen

Boolean

Determines whether the layout is displayed on the interface. When set to false, the layout is hidden and is not evaluated. Default: true.

Margin Above

marginAbove

Text

Determines how much space is added above the layout. Valid values: "NONE" (default), "EVEN_LESS", "LESS", "STANDARD", "MORE", "EVEN_MORE".

Margin Below

marginBelow

Text

Determines how much space is added below the layout. Valid values: "NONE", "EVEN_LESS", "LESS", "STANDARD" (default), "MORE", "EVEN_MORE".

Highlight Color

highlightColor

Text

Determines the highlight color of the selected tab. Valid values: Any valid hex color, hex color including transparency, or '"ACCENT"' (default). To add transparency to the hex color, add two additional digits between 00 (more transparent) and FF (less transparent).

Contents Padding

contentsPadding

Text

Determines the space between the tab edges and its contents. Valid values: "NONE", "EVEN_LESS", "LESS", "STANDARD" (default), "MORE", "EVEN_MORE".

Selected Tab

selectedTab

Text or Integer

Optional parameter used to set and track the active tab's index or id. The tab index is used for the value unless the id parameter is specified in each a!tabItem(). Use a variable to dynamically set this value.

Selected Tab Save Into

selectedTabSaveInto

List of Save

One or more variables that are updated with the active tab's index or id when the user changes tabs. Use a!save() to save a modified or alternative value to a variable.

Using the tab layout

The following sections cover important details about the tab layout.

Controlling the active tab with selectedTab

The selectedTab parameter lets you programmatically control which tab is active. Set selectedTab to a variable that holds either the tab index (starting at 1) or the id value defined on each a!tabItem().

When selectedTab is null, the first visible tab will be active on page load.

To create shareable tab links, pair selectedTab and selectedTabSaveInto with a rule input that maps to a URL parameter on a site or portal page. When a user clicks a tab, selectedTabSaveInto updates the rule input, which updates the URL. When the user navigates back to the page or shares the link, the specified tab loads.

Using tab identifiers for dynamic tabs

When tabs are dynamically shown or hidden, you must use the id parameter on each tab item to keep selectedTab values stable. See Using tab identifiers for details.

Loading behavior

By default, the contents of all tabs evaluate on initial page load. To defer evaluation of specific tabs, use the loadBehavior parameter on a!tabItem(). See Tab loading behavior for details.

To load slow-loading content separately from the rest of the interface, use async loading.

Input error behavior

If a tab has an input error, such as required field that is empty, form submission is blocked.

For any tab that contains an input error, an error icon displays next to the tab label. When an errored tab is not visible due to responsive behavior, the icon shows on the navigation arrow.

Validation errors configured using the validations parameter display above the tab contents on an active tab.

Background color

The tab layout and all tab items are transparent. They will use the color of the component they are placed in.

Margins and padding

  • The marginAbove parameter adds or removes space above the tab bar.
  • The marginBelow parameter adds or removes space below the tab contents of all tab items.
  • The contentsPadding parameter adds or removes space around the contents of all tab items.

Responsive behavior

When the tabs don't fit on the screen, users can use arrows to navigate to more tabs. In the Appian Mobile app, they can swipe the tab bar to see more tabs.

tab layout responsive behavior

Examples

The following examples demonstrate the tab layout.

Basic tab layout

The following example shows a basic tab layout that uses a custom tab highlight color and optional tab icons for each tab item.

Use the interactive editor to experiment with the example.

{ a!tabLayout( tabs: { a!tabItem( label: "Dashboard", icon: "tachometer", contents: { /* This is placeholder content*/ a!cardLayout( contents: a!richTextDisplayField( labelPosition: "COLLAPSED", value: a!richTextItem( text: "The contents of the first tab would go here", style: "EMPHASIS" ), align: "CENTER" ), showBorder: false ) } ), a!tabItem( label: "Cases", icon: "folder-open", contents: { /* This is placeholder content*/ a!cardLayout( contents: a!richTextDisplayField( labelPosition: "COLLAPSED", value: a!richTextItem( text: "The contents of the second tab would go here", style: "EMPHASIS" ), align: "CENTER" ), showBorder: false ) } ), a!tabItem( label: "Search", icon: "search", contents: { /* This is placeholder content*/ a!cardLayout( contents: a!richTextDisplayField( labelPosition: "COLLAPSED", value: a!richTextItem( text: "The contents of the third tab would go here", style: "EMPHASIS" ), align: "CENTER" ), showBorder: false ) } ), a!tabItem( label: "Knowledge Base", icon: "lightbulb-o", contents: { /* This is placeholder content*/ a!cardLayout( contents: a!richTextDisplayField( labelPosition: "COLLAPSED", value: a!richTextItem( text: "The contents of the fourth tab would go here", style: "EMPHASIS" ), align: "CENTER" ), showBorder: false ) } ) }, highlightColor: "#38CF7F" ) }

Role-based default tab

The following example shows how to use selectedTab and selectedTabSaveInto to set the default tab based on the user's group membership. Users in the "Designers" group default to the "Team Workload" tab, while all other users default to the "My Tasks" tab.

To use this with URL parameters on a site or portal page, replace the local variable with a rule input (such as ri!activeTab) and configure it as a URL parameter in the site or portal object.

To experiment with the example, copy and paste the expression into an interface object.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
  a!localVariables(
    /* Determine the default tab based on group membership */
    local!activeTab: if(
      a!isUserMemberOfGroup(
        username: loggedInUser(),
        /* Replace this group constant with a constant from your environment */
        groups: a!groupsByName("Designers")
      ),
      "teamWorkload",
      "myTasks"
    ),
    a!tabLayout(
      tabs: {
        a!tabItem(
          id: "myTasks",
          label: "My Tasks",
          icon: "tasks",
          contents: {
            /* Replace with task list content */
            a!richTextDisplayField(
              labelPosition: "COLLAPSED",
              value: a!richTextItem(
                text: "Task list content goes here",
                style: "EMPHASIS"
              ),
              align: "CENTER"
            )
          }
        ),
        a!tabItem(
          id: "teamWorkload",
          label: "Team Workload",
          icon: "users",
          contents: {
            /* Replace with team workload content */
            a!richTextDisplayField(
              labelPosition: "COLLAPSED",
              value: a!richTextItem(
                text: "Team workload content goes here",
                style: "EMPHASIS"
              ),
              align: "CENTER"
            )
          }
        ),
        a!tabItem(
          id: "systemLogs",
          label: "System Logs",
          icon: "file-text-o",
          contents: {
            /* Replace with system logs content */
            a!richTextDisplayField(
              labelPosition: "COLLAPSED",
              value: a!richTextItem(
                text: "System logs content goes here",
                style: "EMPHASIS"
              ),
              align: "CENTER"
            )
          }
        )
      },
      selectedTab: local!activeTab,
      selectedTabSaveInto: local!activeTab
    )
  )
}

Feature compatibility

The table below lists this component's compatibility with various features in Appian.
Feature Compatibility Note
Portals Compatible
Offline Interfaces Incompatible
Sync-Time Custom Record Fields Incompatible
Real-Time Custom Record Fields Incompatible

Custom record fields that evaluate in real time must be configured using one or more Custom Field functions.

Process Reports Incompatible

Cannot be used to configure a process report.

Process Events Incompatible

Cannot be used to configure a process event node, such as a start event or timer event.

Process Autoscaling Incompatible

Cannot be used in autoscaled processes.

Event Consumer Filter Conditions Compatible

Can be used in filter conditions.

Event Consumer Event Handlers Compatible

Can be used in event handler expressions.

The following recipes include usage of the Tab Layout.

  • Trend-Over-Time Report (Charts, Reports):

    This report provides an attractive, interactive design for exploring different series of data over time.

Feedback