Week View
The week-view
component functions as the base for a weekly calendar interface. It handles scrolling/swiping functionality and calendar events through a flexible modular design. The component is built with a prefilled week
component and an optional week-view-popup
for additional functionality. Its architecture includes slots for header elements, time displays, time indicators and events, enabling comprehensive customization. The component supports horizontal scrolling, configurable number of days display and features a time indicator for current time tracking.
Flexible modular design
Highly customizable
Smooth month scrolling and swiping
Optional popup functionality
Architecture
Reference
-
Week View
This is the root container for the week view of the calendar, providing a comprehensive structure that includes week headers, time slots, time indicators, and events. It also supports an optional popup for additional interactions or information display.
-
Attributes
- css-prefixstring/default: sparkcal
Prefix for all CSS variables
- 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)
- number-of-daysnumber/default: 7
The number of days that should be displayed
- scroll-directionenum/default: horizontal
Direction in which the week 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.
- startstring/default: today
The first day of the view. Format should be YYYY-MM-DD
- swipe-speed-thresholdnumber/default: 0.5
Speed in pixels per millisecond required for a swipe gesture to change the week, regardless of the swipe distance.
- swipe-thresholdnumber/default: 0.2
Threshold in percent of the screen that needs to be swiped to change the week
- widthstring/default: 100%
Width of the component
-
-
Events
- On event click
Fired when a user clicks on a calendar event
- On hour click
Fired when a user clicks on an hour of the day
- On week change
Fired when the week is changed through swipe or scroll
-
-
Style Variables
- --'css-prefix'-week-view-height
Height of the week view
- --'css-prefix'-week-view-width
Width of the week view
-
-
-
Week
The week component displays the actual week within the week-view. It is not standalone and must be a child of the week-view in the week slot.
-
Attributes
- bg-colorstring/default: #171717
Background color of the week
- event-spacingstring/default: 0.125rem
Spacing between events
- hour-heightstring/default: 2.75rem
Height of one hour
- line-colorstring/default: #404040
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'-week-bg-color
Background color of the week
- --'css-prefix'-week-hour-height
Height of one hour
- --'css-prefix'-week-line-color
Color of the separator lines
- --'css-prefix'-week-line-width-horizontal
Width of the horizontal lines
- --'css-prefix'-week-line-width-vertical
Width of the vertical lines
-
-
-
Week Header
The
week-header
component is the header used in theweek
component. It is not standalone and must be used as a child of theweek
component in the header slot.-
Attributes
- bg-colorstring/default: #262626
Background color of the container
- border-colorstring/default: #525252
The border color of the week header
- border-widthstring/default: 1px
Border width of the week header
-
-
Style Variables
- --'css-prefix'-week-header-bg-color
The background color of the week header
- --'css-prefix'-week-header-border-color
Border color of the week header
- --'css-prefix'-week-header-border-width
Border width of the week header
-
-
-
Week Header Number
The
week-header-number
component displays the week number in a week. It is not standalone and must be used in the number slot of theweek-header
component.-
Attributes
- bg-colorstring/default: #404040
Background color of the container
- border-radiusstring/default: 0.25rem
Border radius of the container
- colorstring/default: #A3A3A3
The text color of the week header number
- container-padding-horizontalstring/default: 0.25rem
Horizontal container padding
- container-padding-verticalstring/default: 0rem
Vertical container padding
- font-familystring/default: inherit
Font family of the week header number
- font-sizestring/default: 1rem
Font size of the week header number
- font-weightstring/default: 400
Font weight of the week header number
- horizontal-alignstring/default: end
Horizontal alignment of the week header number
- number-padding-horizontalstring/default: 0.5rem
Horizontal inner padding
- number-padding-verticalstring/default: 0.25rem
Vertical inner padding
- vertical-alignstring/default: center
Vertical alignment of the week header number
-
-
Style Variables
- --'css-prefix'-week-header-number-bg-color
Background color of the container
- --'css-prefix'-week-header-number-border-radius
Border radius of the container
- --'css-prefix'-week-header-number-color
The text color of the week header number
- --'css-prefix'-week-header-number-container-padding-horizontal
Horizontal container padding
- --'css-prefix'-week-header-number-container-padding-vertical
Vertical container padding
- --'css-prefix'-week-header-number-font-family
Font family of the week header number
- --'css-prefix'-week-header-number-font-size
Font size of the week header number
- --'css-prefix'-week-header-number-font-weight
Font weight of the week header number
- --'css-prefix'-week-header-number-horizontal-align
Horizontal alignment of the week header number
- --'css-prefix'-week-header-number-number-padding-horizontal
Horizontal inner padding
- --'css-prefix'-week-header-number-number-padding-vertical
Vertical inner padding
- --'css-prefix'-week-header-number-vertical-align
Vertical alignment of the week header number
-
-
-
Week Header Day
The week-header-day component displays the weekday and the date in a week header. It is not standalone and must be used in the day slot of the week-header.
-
Attributes
- bg-colorstring/default: #262626
Background color of the container
- color-datestring/default: #525252
Text color of the date
- color-weekdaystring/default: #FFFFFF
Text color for the weekday
- color-weekendstring/default: #737373
Text color for the weekend
- font-familystring/default: inherit
Font family of the week header day
- font-size-datestring/default: 0.875rem
Font size of the date
- font-size-weekdaystring/default: 0.875rem
Font size of the weekday
- font-weight-datestring/default: 400
Font weight of the date
- font-weight-weekdaystring/default: 500
Font weight of the weekday
- format-date-configobject/default: {"month":"2-digit", "day": "2-digit"}
Date format configuration
- heightstring/default: 3rem
Height of the component
- number-of-charactersnumber/default: 2
Number of characters to display
- spacingstring/default: 0.125rem
Spacing between weekday and date
- text-transformenum/default: uppercase
Text transform style
-
-
Style Variables
- --'css-prefix'-week-day-header-bg-color
Background color of the container
- --'css-prefix'-week-day-header-color-date
The text color of the date
- --'css-prefix'-week-day-header-font-family
Font family of the week header day
- --'css-prefix'-week-day-header-font-size-date
Font size of the date
- --'css-prefix'-week-day-header-font-weight-date
Font weight of the date
- --'css-prefix'-week-day-header-height
Height of the container
- --'css-prefix'-week-day-header-spacing
Spacing between weekday and date
-
-
-
Week Header Event
The week-header-event component displays all-day events in a week header. It is not standalone and must be used in the event slot of the week-header.
-
Attributes
- bg-colorstring/default: #1D4ED8
Background color of the event
- bg-color-hoverstring/default: #2563EB
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-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
- paddingstring/default: 0.25rem
Inner padding
- past-opacitynumber/default: 0.5
The opacity of the event if it is in the past
- spacingstring/default: 0.25rem
Spacing between 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'-week-header-event-bg-color
Default background color of the event
- --'css-prefix'-week-header-event-bg-color-hover
Default background hover color of the event
- --'css-prefix'-week-header-event-border-radius
Border radius of the event
- --'css-prefix'-week-header-event-color
The default text color of the event
- --'css-prefix'-week-header-event-color-hover
The default text hover color of the event
- --'css-prefix'-week-header-event-font-family
Font family of the event title
- --'css-prefix'-week-header-event-font-size
Font size of the event title
- --'css-prefix'-week-header-event-font-weight
Font weight of the event title
- --'css-prefix'-week-header-event-height
Height of the event
- --'css-prefix'-week-header-event-padding
Inner padding
- --'css-prefix'-week-header-event-past-opacity
The opacity of the event if it is in the past
- --'css-prefix'-week-header-event-spacing
Spacing between events
- --'css-prefix'-week-header-event-transition-duration
Duration for CSS transitions for the hover effect
- --'css-prefix'-week-header-event-transition-easing
Easing function for CSS transitions for the hover effect
-
-
-
Week View Popup
The week-view-popup component is a popup for the week-view. It must be placed in the popup slot of the week-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 week-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'-week-view-popup-max-width
Maximum width of the popup
- --'css-prefix'-week-view-popup-spacing-edge
Spacing from the edge of the week-view
-
-
-
Week Event
The week-event component displays the calendar events of a week. It is not standalone and has to be placed in the event slot of the week component.
-
Attributes
- bg-colorstring/default: #1D4ED8
Background color of the event
- bg-color-hoverstring/default: #2563EB
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-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
- paddingstring/default: 0.25rem
Inner padding
- past-opacitynumber/default: 0.5
The opacity when the event is in the past
- 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'-week-event-bg-color
Default background color of the event
- --'css-prefix'-week-event-bg-color-hover
Default background hover color of the event
- --'css-prefix'-week-event-border-radius
Border radius of the event
- --'css-prefix'-week-event-color
The default text color of the event
- --'css-prefix'-week-event-color-hover
The default text hover color of the event
- --'css-prefix'-week-event-font-family
Font family of the event title
- --'css-prefix'-week-event-font-size
Font size of the event title
- --'css-prefix'-week-event-font-weight
Font weight of the event title
- --'css-prefix'-week-event-padding
Inner padding
- --'css-prefix'-week-event-past-opacity
The opacity of the event if it is in the past
- --'css-prefix'-week-event-transition-duration
Duration for CSS transitions for the hover effect
- --'css-prefix'-week-event-transition-easing
Easing function for CSS transitions for the hover effect
-
-
-
Week Time
The week-time component displays time in a week. It is not standalone and must be used in the time slot of the week component.
-
Attributes
- colorstring/default: #525252
Text color of the time
- font-familystring/default: inherit
Font family for the time
- font-sizestring/default: 0.875rem
Font size of the time
- font-weightstring/default: 400
Font weight of the time
- hour-formatenum/default: 12h
Height of the component
- padding-rightstring/default: 0.25rem
Padding on the right side
- widthstring/default: 4rem
Width of the component
-
-
Style Variables
- --'css-prefix'-week-time-color
Text color of the time
- --'css-prefix'-week-time-font-family
Font family for the time
- --'css-prefix'-week-time-font-size
Font size of the time
- --'css-prefix'-week-time-font-weight
Font weight of the time
- --'css-prefix'-week-time-padding-right
Padding on the right side
- --'css-prefix'-week-time-width
Width of the component
-
-
-
Week Time Indicator
The week-time-indicator component indicates the current time of the day. It is not standalone and must be used in the indicator slot of the week component.
-
Attributes
- circle-sizestring/default: 0.5rem
Size of the indicator circle
- colorstring/default: #A3A3A3
Color of the indicator
- line-widthstring/default: 1px
Width of the indicator line
-
-
Style Variables
- --'css-prefix'-week-time-indicator-circle-size
Size of the indicator circle
- --'css-prefix'-week-time-indicator-color
Color of the indicator
- --'css-prefix'-week-time-indicator-line-width
Width of the indicator line
-
-
Context
-
weekViewContext
Contains the current state of the week view and handlers for events
-
weekViewPopupContext
Contains the current event that is opened in the popup