Components/Calendar

fd-calendar · 6 examples from SAP's documentation · Back to the gallery

About

The calendar component allows users to navigate to a single date, multiple days, whole week(s), or a date range, showing all time-related data within a given timeframe. It is usually paired with components: **Input Group** and **Popover** to comprise **Date Picker**, which is considered a design pattern as the date picker does not contain components of its own. The calendar component is rarely, if ever, used as a standalone component.

**Use the calendar if:** - You want the user to select a single date, multiple days, whole week(s), or a date range. - You want to display multiple months or years at once. - The calendar always needs to be visible and prominent. - Users need to see the year, month, week, weekday and date at a glance to decide which date to select. For example, a user might want to select a date based on the day of the week. - Users might be used to different locale-specific date formats (such as day-month-year or month-day-year). Enabling them to select the date visually using the calendar bypasses format-specific interpretation. - You want to highlight special days or hide/disable specific days. **Do not use the calendar if:** - The user is a power user who has to enter a lot of data fast. In this case, use the **Date Picker** pattern instead. - The keyboard is the primary input device. In this case, use the **Date Picker** pattern instead. - The available screen space is limited and displaying the calendar permanently would take up too much space. The following classes describe the block structure of the calendar component.\n - \ - The user is a power user who has to enter a lot of data fast. In this case, use the **Date Picker** pattern instead. - The keyboard is the primary input device. In this case, use the **Date Picker** pattern instead. - The available screen space is limited and displaying the calendar permanently would take up too much space. The following classes describe the block structure of the calendar component.\n - \

CalendarDays

Days

The calendar component can display days of the month by adding the `fd-calendar__content--dates` class to the container element.

Sun
Mon
Tue
Wed
Thu
Fri
Sat
5
30
31
1
2
3
4
5
6
6
7
8
9
10
11
12
7
13
14
15
16
17
18
19
8
20
21
22
23
24
25
26
9
27
28
1
2
3
4
5
Use arrow keys to navigate dates
Sun
Mon
Tue
Wed
Thu
Fri
Sat
30
31
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
1
2
3
4
5
Use arrow keys to navigate dates

Months

The calendar component can display months in a year by adding the `fd-calendar__content--months` class to the container element.

January February March
April May June
July August September
October November December
Use arrow keys to navigate dates

Years

The calendar component can display a range of years in various ways: short-term, long-term, year ranges etc. Add the `fd-calendar__content--years` class to the container element, and adjust the number of columns, rows, and content to fit your use case.

2018 2019 2020 2021 2022
2023 2024 2025 2026 2027
2028 2029 2030 2031 2032
2033 2034 2035 2036 2037
Use arrow keys to navigate dates
2010 - 2020 2021 - 2031 2032 - 2042
2043 - 2053 2054 - 2064 2065- 2075
2076 - 2086 2087 - 2097 2098 - 2108
2109 - 2119 2120 - 2130 2131 - 2141
Use arrow keys to navigate dates
2010 BC - 2020 BC 2021 BC - 2031 BC
2032 BC - 2042 BC 2043 BC - 2053 BC
2054 BC - 2064 BC 2065 BC - 2075 BC
2076 BC - 2086 BC 2087 BC - 2097 BC
Use arrow keys to navigate dates
2010 Showa - 2020 Showa
2021 Showa - 2031 Showa
2032 Showa - 2042 Showa
2043 Showa - 2053 Showa
Use arrow keys to navigate dates

Legend

The Calendar component can display a customizable legend to help users interpret the meaning of various colors and styles used within the calendar. The legend includes: - 20 predefined color placeholders: fd-calendar-legend__item--placeholder-1...fd-calendar-legend__item--placeholder-20 - selection: fd-calendar-legend__item--selected - today: fd-calendar-legend__item--today - normal (work) days: fd-calendar-legend__item--work - non-working days: fd-calendar-legend__item--non-work. The number of flexible columns should be configurable to prevent label truncation, though labels can also wrap to accommodate longer text. Use fd-calendar-legend--auto-column for auto column width. Appointments are represented by circles fd-calendar-legend__item--appointment, while special calendar days are depicted as squares (default).

Today
Selected
Work Day
Non-Work Day
Holiday
School Vacation
Wedding
Today Lorem ipsum dolor sit, amet consectetur adipisicing elit. Nostrum officiis eligendi qui aliquid eius omnis dolorem obcaecati libero magnam.
Selected
Work Day
Non-Work Day
Special Day Placeholder 1
Special Day Placeholder 2
Special Day Placeholder 3
Special Day Placeholder 4
Special Day Placeholder 5
Special Day Placeholder 6
Special Day Placeholder 7
Special Day Placeholder 8
Special Day Placeholder 9
Special Day Placeholder 10
Today Lorem ipsum dolor sit, amet consectetur adipisicing elit. Nostrum officiis eligendi qui aliquid eius omnis dolorem obcaecati libero magnam.
Selected
Work Day
Non-Work Day
Special Day Placeholder 11
Special Day Placeholder 12
Special Day Placeholder 13
Special Day Placeholder 14
Special Day Placeholder 15
Special Day Placeholder 16
Special Day Placeholder 17
Special Day Placeholder 18
Special Day Placeholder 19
Special Day Placeholder 20

Two-Month Calendar

For date range selection use cases the calendar can provide 2-month view. The adjacent month days and the inner buttons are hidden. In cases where the width of the screen is not enough the 2-month calendar is turning into a vertical structure. Use the modifier class .fd-calendar-container--vertical for vertical layout. On phone the Calendar popover turns into full screen dialog with only one month and taking back the adjacent month days.

Horizontal

Mon
Tue
Wed
Thu
Fri
Sat
Sun
5
30
31
1
2
3
4
5
6
6
7
8
9
10
11
12
7
13
14
15
16
17
18
19
8
20
21
22
23
24
25
26
9
27
28
1
2
3
4
5
Use arrow keys to navigate dates
Mon
Tue
Wed
Thu
Fri
Sat
Sun
10
27
28
1
2
3
4
5
11
6
7
8
9
10
11
12
12
13
14
15
16
17
18
19
13
20
21
22
23
24
25
26
14
27
28
29
30
31
1
2
Use arrow keys to navigate dates

Vertical

Mon
Tue
Wed
Thu
Fri
Sat
Sun
5
30
31
1
2
3
4
5
6
6
7
8
9
10
11
12
7
13
14
15
16
17
18
19
8
20
21
22
23
24
25
26
9
27
28
1
2
3
4
5
Use arrow keys to navigate dates
Mon
Tue
Wed
Thu
Fri
Sat
Sun
10
27
28
1
2
3
4
5
11
6
7
8
9
10
11
12
12
13
14
15
16
17
18
19
13
20
21
22
23
24
25
26
14
27
28
29
30
31
1
2
Use arrow keys to navigate dates

Mobile

Calendar

Mon
Tue
Wed
Thu
Fri
Sat
Sun
5
30
31
1
2
3
4
5
6
6
7
8
9
10
11
12
7
13
14
15
16
17
18
19
8
20
21
22
23
24
25
26
9
27
28
1
2
3
4
5
Use arrow keys to navigate dates