Event Timeline

Interface patterns give you an opportunity to explore different interface designs. Be sure to check out How to Adapt a Pattern for Your Application.

Goal

Use the event timeline pattern to display a dated list of events and actions in chronological order. This pattern uses a combination of cards, rich text, and user images to show an easy to navigate list of dated events. This page explains how you can use this pattern in your interface, and walks through the design structure in detail.

screenshot of the event timeline pattern

Design structure

This page will break down this expression so you can better understand how to adapt this pattern to your own data so that it works to best suit your needs.

The main components in this pattern are columns layouts, card layouts, side by side layouts, user images, and rich text. The image below displays how the pattern looks on a blank interface with callouts for the main components. You can examine the entire expression or jump down to the subsections below with referenced line numbers to see a detailed breakdown of the main components.

screenshot of the event timeline pattern with two callouts highlighting that there are user images, user record links, and rich text within a card layout to define the events, as well as rich text in a column layout to define the date that the event took place.

Pattern expression

When you drag and drop the event timeline pattern onto your interface, 109 lines of expressions will be added to the section where you dragged it.

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{
  a!localVariables(
    local!eventTimeline: {
      a!map(
        date: today(),
        events:  {
          a!map(user: "Bree Mercer", event: "edited the customer record for Acme Corporation", time: "02:40 PM"),
          a!map(user: "Anthony Wu",  event: "edited the customer record for Acme Corporation", time: "11:03 AM"),
          a!map(user: "John Smith",  event: "edited the customer record for Acme Corporation", time: "10:25 AM"),
          a!map(user: "John Smith",  event: "edited the customer record for Acme Corporation", time: "08:19 AM")
        }
      ),
      a!map(
        date: today() - 1,
        events:  {
          a!map(user: "John Smith",  event: "edited the customer record for Acme Corporation", time: "05:49 PM"),
          a!map(user: "Bree Mercer", event: "edited the customer record for Acme Corporation", time: "02:44 AM"),
          a!map(user: "Bree Mercer", event: "edited the customer record for Acme Corporation", time: "02:10 PM"),
          a!map(user: "John Smith",  event: "edited the customer record for Acme Corporation", time: "12:52 AM"),
          a!map(user: "Anthony Wu",  event: "edited the customer record for Acme Corporation", time: "09:33 AM")
        }
      )
    },
    {
      a!forEach(
        items: local!eventTimeline,
        expression: a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!richTextDisplayField(
                  labelPosition: "COLLAPSED",
                  value: {
                    a!richTextItem(
                      text: day(fv!item.date),
                      size: "LARGE"
                    ),
                    char(10),
                    upper(text(fv!item.date, "MMM"))
                  },
                  align: "CENTER"
                )
              },
              width: "EXTRA_NARROW"
            ),
            a!columnLayout(
              contents: {
                a!forEach(
                  items: fv!item.events,
                  expression: a!cardLayout(
                    contents: {
                      a!sideBySideLayout(
                        items: {
                          a!sideBySideItem(
                            item: a!imageField(
                              labelPosition: "COLLAPSED",
                              images: a!userImage(),
                              size: "SMALL",
                              style: "AVATAR"
                            ),
                            width: "MINIMIZE"
                          ),
                          a!sideBySideItem(
                            item: a!richTextDisplayField(
                              labelPosition: "COLLAPSED",
                              value: {
                                a!richTextItem(
                                  text: fv!item.user,
                                  link: a!userRecordLink(),
                                  linkStyle: "STANDALONE",
                                  size: "MEDIUM",
                                  style: "STRONG"
                                ),
                                a!richTextItem(
                                  text: " " & fv!item.event,
                                  size: "MEDIUM"
                                )
                              }
                            )
                          ),
                          a!sideBySideItem(
                            item: a!richTextDisplayField(
                              labelPosition: "COLLAPSED",
                              value: {
                                a!richTextItem(
                                  text: fv!item.time,
                                  color: "SECONDARY",
                                  size: "MEDIUM"
                                )
                              }
                            ),
                            width: "MINIMIZE"
                          )
                        },
                        alignvertical: "MIDDLE"
                      )
                    },
                    marginBelow: "STANDARD"
                  )
                )
              }
            )
          },
          marginbelow: "NONE"
        )
      )
    }
  )
}

[Line 1-23] Define local variables and mappings

The local variables at the top of the expression are used to define the data that will be displayed for each event in the timeline, as well as map together the user information, time of the event, and description of the event.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  a!localVariables(
    local!eventTimeline: {
      a!map(
        date: today(),
        events:  {
          a!map(user: "Bree Mercer", event: "edited the customer record for Acme Corporation", time: "02:40 PM"),
          a!map(user: "Anthony Wu",  event: "edited the customer record for Acme Corporation", time: "11:03 AM"),
          a!map(user: "John Smith",  event: "edited the customer record for Acme Corporation", time: "10:25 AM"),
          a!map(user: "John Smith",  event: "edited the customer record for Acme Corporation", time: "08:19 AM")
        }
      ),
      a!map(
        date: today() - 1,
        events:  {
          a!map(user: "John Smith",  event: "edited the customer record for Acme Corporation", time: "05:49 PM"),
          a!map(user: "Bree Mercer", event: "edited the customer record for Acme Corporation", time: "02:44 AM"),
          a!map(user: "Bree Mercer", event: "edited the customer record for Acme Corporation", time: "02:10 PM"),
          a!map(user: "John Smith",  event: "edited the customer record for Acme Corporation", time: "12:52 AM"),
          a!map(user: "Anthony Wu",  event: "edited the customer record for Acme Corporation", time: "09:33 AM")
        }
      )
    },

[Line 24-45] Format the month and day display

This section opens up the a!forEach() expression and columns layout which define the timeline's structure. Using a!forEach(), we can define the expression for an event one time and have the function iterate through that same expression for each event instance.

This section also contains the expression which displays the day and month that each event takes place. The dates are made up of rich text in a column layout with a few functions to configure how the dates are displayed.

On line 35, the day() function is used to convert the date and time value defined in the local variable into a single number(integer) value.

On line 39, the text() function is used to convert the date and time value defined in the local variable into a text value. The MMM format in this expression formats the month into a three letter abbreviation:dec. The text() function is wrapped in the upper() function, which converts text values to uppercase: DEC.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    {
      a!forEach(
        items: local!eventTimeline,
        expression: a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!richTextDisplayField(
                  labelPosition: "COLLAPSED",
                  value: {
                    a!richTextItem(
                      text: day(fv!item.date),
                      size: "LARGE"
                    ),
                    char(10),
                    upper(text(fv!item.date, "MMM"))
                  },
                  align: "CENTER"
                )
              },
              width: "EXTRA_NARROW"
            ),

[Line 46-109] Configure the event display

This section defines the expression that will be iterated through for each event in the timeline. The events are made up of a user image in the "AVATAR" style, the user's name and a link to their user record, a description of the event, and the time of the event.

The user name, event description, and the time of the event are all displayed in rich text. The rich text and user image are all in a side by side layout contained within a card.

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
          a!columnLayout(
              contents: {
                a!forEach(
                  items: fv!item.events,
                  expression: a!cardLayout(
                    contents: {
                      a!sideBySideLayout(
                        items: {
                          a!sideBySideItem(
                            item: a!imageField(
                              labelPosition: "COLLAPSED",
                              images: a!userImage(),
                              size: "SMALL",
                              style: "AVATAR"
                            ),
                            width: "MINIMIZE"
                          ),
                          a!sideBySideItem(
                            item: a!richTextDisplayField(
                              labelPosition: "COLLAPSED",
                              value: {
                                a!richTextItem(
                                  text: fv!item.user,
                                  link: a!userRecordLink(),
                                  linkStyle: "STANDALONE",
                                  size: "MEDIUM",
                                  style: "STRONG"
                                ),
                                a!richTextItem(
                                  text: " " & fv!item.event,
                                  size: "MEDIUM"
                                )
                              }
                            )
                          ),
                          a!sideBySideItem(
                            item: a!richTextDisplayField(
                              labelPosition: "COLLAPSED",
                              value: {
                                a!richTextItem(
                                  text: fv!item.time,
                                  color: "SECONDARY",
                                  size: "MEDIUM"
                                )
                              }
                            ),
                            width: "MINIMIZE"
                          )
                        },
                        alignvertical: "MIDDLE"
                      )
                    },
                    marginBelow: "STANDARD"
                  )
                )
              }
            )
          },
          marginbelow: "NONE"
        )
      )
    }
  )
}
Open in Github Built: Thu, Oct 14, 2021 (02:44:31 PM)

On This Page

FEEDBACK