Month View
The month-view
component serves as the foundation for a monthly calendar display. It manages scrolling/swiping functionality and calendar events through a modular architecture. The component consists of a prefilled month
component and an optional month-view-popup
for enhanced interactions. Its structure allows for extensive customization through various slots, including week numbers, weekdays, day headers, events and overflow handling. The component supports horizontal and vertical scrolling, customizable event handling and responsive design with configurable dimensions.
Flexible modular design
Highly customizable
Smooth month scrolling and swiping
Optional popup functionality
Architecture
Reference
-
Month View
This component serves as the root container for the month calendar view, offering a flexible structure with optional week numbers and weekdays. It includes slots for day headers, events, and an overflow mechanism, along with an optional popup for additional interactions.
-
Attributes
- css-prefixstring/default: sparkcal
Prefix for all CSS variables
- enable-event-clickboolean/default: true
Determines if a click on an event is recognized (fires
On event click
). If false, theOn day click
event will fire instead. - eventsarray/default: []
The events to be displayed in the calendar.
- heightstring/default: 100%
Height of the component.
- initial-render-delay-msnumber/default: 250
Time in milliseconds the view is unresponsive on initial render (improves render speed).
- monthstring/default: current month
The month to be displayed. In the format "YYYY-MM"
- scroll-directionenum/default: horizontal
Direction in which the month can be scrolled and swiped.
- scroll-durationstring/default: 250ms
The duration of the scroll animation.
- scroll-easingstring/default: ease
The easing function of the scroll animation.
- start-of-weekenum/default: monday
The start day of the week.
- swipe-speed-thresholdnumber/default: 0.5
Speed in pixels per millisecond required for a swipe gesture to change the month, regardless of the swipe distance.
- swipe-thresholdnumber/default: 0.2
Threshold in percent of the screen that needs to be swiped to change the month
- widthstring/default: 100%
Width of the component
-
-
Events
- On day click
Fired when a user clicks on a day or day header
- On event click
Fired when a user clicks on a calendar event
- On month change
Fired when the month is changed through swipe or scroll
-
-
Style Variables
- --'css-prefix'-month-view-height
Height of the month view
- --'css-prefix'-month-view-width
Width of the month view
-
-
-
Month
The month component displays the actual month within the month-view. It is not standalone and must be a child of the month-view in the month slot.
-
Attributes
- bg-colorstring/default: #171717
Color of the month’s background
- line-colorstring/default: #262626
Color of the separator lines
- line-width-horizontalstring/default: 1px
Width of the horizontal lines
- line-width-verticalstring/default: 1px
Width of the vertical lines
-
-
Style Variables
- --'css-prefix'-month-bg-color
Color of the month's background
- --'css-prefix'-month-line-color
Color of the separator lines
- --'css-prefix'-month-line-width-horizontal
Width of the horizontal lines
- --'css-prefix'-month-line-width-vertical
Width of the vertical lines
-
-
-
Month Week Numbers
The
month-week-numbers
component is used to display week numbers at the top of themonth
component. It is not standalone and must be a child of themonth
component in the week-numbers slot.-
Attributes
- bg-colorstring/default: #262626
Background color of the container
- colorstring/default: #A3A3A3
The text color of the week numbers
- font-familystring/default: inherit
Font family of the week numbers
- font-sizestring/default: 1rem
Font size of the week numbers
- font-weightstring/default: 500
Font weight of the week numbers
- widthstring/default: 2rem
Width of the week number container
-
-
Style Variables
- --'css-prefix'-month-week-numbers-bg-color
Background color of the container
- --'css-prefix'-month-week-numbers-color
Text color of the week numbers
- --'css-prefix'-month-week-numbers-font-family
Font family of the week numbers
- --'css-prefix'-month-week-numbers-font-size
Font size of the week numbers
- --'css-prefix'-month-week-numbers-font-weight
Font weight of the week numbers
- --'css-prefix'-month-week-numbers-spacing
Spacing between week numbers. Defaults to horizontal line width of the month component
- --'css-prefix'-month-week-numbers-width
Width of the week numbers container
-
-
-
Month Weekdays
The
month-weekdays
component is used as the header of the month. It is not standalone and must be placed in the weekdays slot of themonth
component.-
Attributes
- bg-colorstring/default: #262626
Background color of the outer container
- bg-color-containerstring/default: #262626
Background color of the weekdays container
- colorstring/default: #A3A3A3
The text color of the weekday
- color-weekendstring/default: #737373
The text color of the weekday on weekends
- font-familystring/default: inherit
Font family of the weekdays
- font-sizestring/default: 1rem
Font size of the weekdays
- font-weightstring/default: 500
Font weight of the weekdays
- heightstring/default: 2rem
Height of the weekday
- number-of-charactersnumber/default: 2
Number of characters of weekday
- text-transformstring/default: uppercase
Text transformation style for the weekday
-
-
Style Variables
- --'css-prefix'-month-weekdays-bg-color
Background color of the outer container
- --'css-prefix'-month-weekdays-bg-color-container
Background color of the weekdays container
- --'css-prefix'-month-weekdays-color
The text color of the weekday
- --'css-prefix'-month-weekdays-color-weekend
The text color of the weekday on weekends
- --'css-prefix'-month-weekdays-font-family
Font family of the weekdays
- --'css-prefix'-month-weekdays-font-size
Font size of the weekdays
- --'css-prefix'-month-weekdays-font-weight
Font weight of the weekdays
- --'css-prefix'-month-weekdays-height
Height of the container
- --'css-prefix'-month-weekdays-padding-left
Padding left of the weekdays container. Defaults to the width of the wee-numbers component
- --'css-prefix'-month-weekdays-spacing
Spacing between the weekday labels. Defaults to the line-width-vertical of the month component
- --'css-prefix'-month-weekdays-text-transform
The text-transform of the weekday label
-
-
-
Month Day Header
The
month-day-header
component is the header of each day in a month. It cannot be used standalone but must be placed in amonth
component in the day-header slot.-
Attributes
- bg-colorstring/default: #171717
Background color of the container
- bg-color-todaystring/default: #1D4ED8
Background color of the today indicator
- border-radius-todaystring/default: 0.875rem
Border radius of the today indicator
- colorstring/default: #FFFFFF
The text color of the day number
- color-next-monthstring/default: #737373
The text color of the day number when the day is in the next month
- color-paststring/default: #737373
The text color of the day number when the day is in the past
- color-previous-monthstring/default: #737373
The text color of the day number when the day is in the previous month
- color-todaystring/default: #FFFFFF
Text color of the today indicator
- font-familystring/default: inherit
Font family of the day number
- font-sizestring/default: 1rem
Font size of the week numbers
- font-weightstring/default: 500
Font weight of the day number
- heightstring/default: 2rem
Height of the container
- size-todaystring/default: 1.75rem
Size of the today indicator
-
-
Style Variables
- --'css-prefix'-month-day-header-bg-color
Background color of the container
- --'css-prefix'-month-day-header-bg-color-today
Background color of the today indicator
- --'css-prefix'-month-day-header-border-radius-today
Radius of the today indicator
- --'css-prefix'-month-day-header-color
The text color of the day number
- --'css-prefix'-month-day-header-color-next-month
The text color of the day number when the day is in the next month
- --'css-prefix'-month-day-header-color-past
The text color of the day number when the day is in the past
- --'css-prefix'-month-day-header-color-previous-month
The text color of the day number when the day is in the previous month
- --'css-prefix'-month-day-header-color-today
Text color of the today indicator
- --'css-prefix'-month-day-header-font-family
Font family of the day number
- --'css-prefix'-month-day-header-font-size
Font size of the day number
- --'css-prefix'-month-day-header-font-weight
Font weight of the day number
- --'css-prefix'-month-day-header-height
Height of the container
- --'css-prefix'-month-day-header-size-today
Size of the today indicator
-
-
-
Month Event
The
month-event
component displays a calendar event. It is not standalone and must be used in the event slot of themonth
component.-
Attributes
- bg-colorstring/default: #1D4ED8
Background color of the event
- bg-color-hoverstring/default: #1D4ED8
Default background hover color of the event
- border-radiusstring/default: 0.25rem
Border radius of the event
- colorstring/default: #FFFFFF
The text color of the event
- color-altstring/default: #FFFFFF
The default text color of non all-day events when show-time is set to true
- color-alt-hoverstring/default: #FFFFFF
The default text hover color of non all-day events when
show-time
is set totrue
- color-hoverstring/default: #FFFFFF
The default text hover color of the event
- font-familystring/default: inherit
Font family of the event title
- font-sizestring/default: 0.875rem
Font size of the event title
- font-weightstring/default: 400
Font weight of the event title
- heightstring/default: 1.5rem
Height of the event
- hour-formatenum/default: 24h
The hour format of the displayed time
- paddingstring/default: 0.25rem
Inner padding
- past-opacitynumber/default: 0.5
The opacity of the event if it is in the past
- show-timeboolean/default: true
If
true
, it will show the time for non all-day events - spacingstring/default: 0.25rem
Spacing between events
- transition-durationstring/default: 250ms
The transition duration for hover transitions
- transition-easingstring/default: ease
The transition easing function for hover transitions
-
-
Style Variables
- --'css-prefix'-month-event-bg-color
Default background color of the event
- --'css-prefix'-month-event-bg-color-hover
Default background hover color of the event
- --'css-prefix'-month-event-border-radius
Border radius of the event
- --'css-prefix'-month-event-color
The default text color of the event
- --'css-prefix'-month-event-color-alt
The default text color of non all-day events when show-time is set to true
- --'css-prefix'-month-event-color-alt-hover
The default text hover color of non all-day events when show-time is set to true
- --'css-prefix'-month-event-color-hover
The default text hover color of the event
- --'css-prefix'-month-event-font-family
Font family of the event title
- --'css-prefix'-month-event-font-size
Font size of the event title
- --'css-prefix'-month-event-font-weight
Font weight of the event title
- --'css-prefix'-month-event-height
Height of the event
- --'css-prefix'-month-event-padding
Inner padding
- --'css-prefix'-month-event-past-opacity
The opacity of the event if it is in the past
- --'css-prefix'-month-event-spacing
Spacing between events
- --'css-prefix'-month-event-transition-duration
The transition duration for hover transitions
- --'css-prefix'-month-event-transition-easing
The transition easing function for hover transitions
-
-
-
Month Overflow
The month-overflow component is displayed when events exceed the available visual space. It is not standalone and must be placed in the overflow slot of the month component.
-
Attributes
- bg-colorstring/default: #404040
Background color of the overflow
- bg-color-hoverstring/default: #525252
Default background hover color of the overflow
- border-radiusstring/default: 0.25rem
Border radius of the overflow
- colorstring/default: #FFFFFF
The text color of the overflow
- color-hoverstring/default: #FFFFFF
The default text hover color of the overflow
- font-sizestring/default: 0.875rem
Font size of the overflow title
- past-opacitynumber/default: 0.5
The opacity when overflow is in the past
- spacingstring/default: 0.25rem
Spacing between overflows and events
- transition-durationstring/default: 250ms
Duration for CSS transitions for the hover effect
- transition-easingstring/default: ease
Easing function for CSS transitions for the hover effect
-
-
Style Variables
- --'css-prefix'-overflow-bg-color
Default background color of the overflow
- --'css-prefix'-overflow-bg-color-hover
Default background hover color of the overflow
- --'css-prefix'-overflow-border-radius
Border radius of the overflow
- --'css-prefix'-overflow-color
The default text color of the overflow
- --'css-prefix'-overflow-color-hover
The default text hover color of the overflow
- --'css-prefix'-overflow-font-size
Font size of the overflow title
- --'css-prefix'-overflow-past-opacity
Opacity when overflow is in the past
- --'css-prefix'-overflow-spacing
Spacing between overflows and events
- --'css-prefix'-overflow-transition-duration
Duration for CSS transitions for the hover effect
- --'css-prefix'-overflow-transition-easing
Easing function for CSS transitions for the hover effect
-
-
-
Month View Popup
The month-view-popup component is a popup for the month-view. It must be placed in the popup slot of the month-view.
-
Attributes
- distance-eventstring/default: 0.25rem
Distance from the event the popup is attached to
- max-widthstring/default: 80%
Maximum width of the popup
- offsetstring/default: 0px
Vertical offset of the popup
- spacing-edgestring/default: 1rem
Spacing from the edge of the month-view
- transition-durationstring/default: 250ms
Duration of the fade-in transition
- transition-easingstring/default: ease
Easing function of the fade-in transition
- transition-offsetstring/default: 0.5rem
Horizontal offset for the fade-in transition
-
-
Style Variables
- --'css-prefix'-month-view-popup-max-width
Maximum width of the popup
- --'css-prefix'-month-view-popup-spacing-edge
Spacing from the edge of the month-view
-
-
Context
-
monthViewContext
Contains the current state of the month view and handlers for events
-
monthViewPopupContext
Contains the current event that is opened in the popup