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
Non Working Day
Non Working Day(Legend)
Selected/First/Last in range
Selected/First/Last in range(Legend)
Range Selection
Range Selection(Legend)
Today
Today(Legend)
Today Selection
Today Selection(Legend)
Today Range Selection
Today Range Selection(Legend)
Non-current month dates
Week Number/Week Day Name
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
|
|
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
|
Months
The calendar component can display months in a year by adding the `fd-calendar__content--months` class to the container element.
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.
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).
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
|
|
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
|
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
|
|
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
|
Mobile
|
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
|