Skip to main content

Calendar

A control element that displays a full calendar month at one time.

Submit feedback
github
() => {
const [value, setValue] = useState(new Date());
return (
<Calendar
value={value}
onChange={setValue}
minimumDate={new Date(2023, 7, 10)}
maximumDate={new Date(2025, 6, 28)}
goals={[
{ date: new Date(2023, 9, 23), state: 'progress', percentage: 23 },
{ date: new Date(2023, 9, 24), state: 'progress', percentage: 100 },
{ date: new Date(2023, 9, 25), state: 'complete' },
]}
/>
)
}

useState

Using the useState hook gets values from the component state.

Minimum and Maximum Date

Use the minimumDate and maximumDate props to set the min and max dates in the Calendar. The default values will be a 1 year range from the prop value.

Excluded Dates

To exclude dates use the excludeDate prop. Set a function that receives date as an argument and returns true if date should be disabled. For example, to disable weekends, check if the day is 0 or 6.

Goals

Use the goals prop to add rewards to certain days on the calendar.

The goals prop must be an array of 'Goal' objects. A goal object has three properties

  • date: The date the reward will be. Must be a date instance.
  • state: The current state of the reward. Valid values are 'progress' and 'complete'.
  • percentage: If the state of the goal is 'progress', you can add the completed percentage. Defaults to 50.

Calendar Props

Prop NameTypeDefaultDescription
excludeDateFunction-Callback fired to exclude dates from the calendar
goalsArray-An array used to add rewards markers to certain days on the calendar
maximumDateDate-Specifies the maximum selectable day by a user
minimumDateDate-Specifies the minimum selectable day by a user
onChangeFunction-Callback fired every time the value changes
valueDate-Selected calendar date

Calendar Classes

Class NameDescriptionStates
abyss-calendar-back-month-buttonCalendar back month button
abyss-calendar-back-month-iconCalendar back month icondisabled
abyss-calendar-contentCalendar content
abyss-calendar-dates-wrapperCalendar dates wrapper
abyss-calendar-day-buttonCalendar day button
abyss-calendar-day-labelCalendar day labeldisabled, selected
abyss-calendar-day-of-weekCalendar day of week
abyss-calendar-forward-month-buttonCalendar forward month button
abyss-calendar-forward-month-iconCalendar forward month icondisabled
abyss-calendar-goal-starCalendar goal star
abyss-calendar-headerCalendar header
abyss-calendar-month-buttonCalendar month-button
abyss-calendar-month-chevronCalendar month chevron arrow
abyss-calendar-month-labelCalendar month label
abyss-calendar-progress-circleCalendar progress circle
abyss-calendar-rootCalendar root element
abyss-calendar-selection-circleCalendar selection circle
abyss-calendar-today-circleCalendar today circle

Calendar Translations

Translation KeyValue
selectedSelected
Calendar.prevMonthPrevious Month
Calendar.nextMonthNext Month
Calendar.yearYear
Calendar.todayToday
Calendar.inProgressIn Progress

Dynamic Type

Calendar scales to 3XL. Star icon does not grow.

The date picker component in Abyss library is currently not accessible to users relying on screen readers and therefore it is hidden from screen reader users. Please use the date input method as an alternative to the date picker.

Calendar Tokens

Token NameValue
calendar.color.surface.container
#FFFFFF
calendar.color.surface.date.enabled.selected
#002677
calendar.color.surface.date.goal-reached.default
#F5B700
calendar.color.surface.date.goal-reached.selected
#002677
calendar.color.surface.date.sweep.track
#007000
calendar.color.surface.date.sweep.container
#F3F3F3
calendar.color.text.week-days
#4B4D4F
calendar.color.text.heading
#002677
calendar.color.text.date.enabled.default
#002677
calendar.color.text.date.enabled.selected
#FFFFFF
calendar.color.text.date.disabled
#929496
calendar.color.icon.header.rest
#002677
calendar.color.icon.header.disabled
#929496
calendar.color.icon.date.goal-reached
#FFFFFF
calendar.color.border.date.goal-reached
#D2800F
calendar.color.border.date.today.enabled
#002677
calendar.color.border.date.today.disabled
#929496
calendar.border-radius.all.date
500
calendar.border-width.all.date.today
2
calendar.border-width.all.date.goal-reached
1
calendar.sizing.all.icon.header
24
calendar.sizing.all.icon.date
40
calendar.spacing.gap.horizontal.header
16
calendar.spacing.gap.horizontal.nav-buttons
4
calendar.spacing.padding.horizontal.container
16
calendar.spacing.padding.vertical.week
4
calendar.spacing.padding.vertical.week-days
4
calendar.spacing.padding.vertical.header
16
calendar.spacing.padding.bottom.container
8
Table of Contents