Year calendar.
export const component: DraymanComponent = async ({ forceUpdate }) => { let selectedDates = ['2025-01-01']; return () => { return ( <div> <p>Selected dates count: {selectedDates.length}</p> <drayman-year-calendar selectedDates={selectedDates} year={2025} onDayClick={async ({ date }) => { if (selectedDates.includes(date)) { selectedDates = selectedDates.filter((d) => d !== date); } else { selectedDates.push(date); } await forceUpdate(); }} /> </div> ); } }
Executed when user clicks on a day.
Array of selected dates in YYYY-MM-DD format.
The year to display. If not provided, the current year will be used.
<drayman-year-calendar />
Year calendar.
Example of usage
Year calendar with selected dates.
export const component: DraymanComponent = async ({ forceUpdate }) => { let selectedDates = ['2025-01-01']; return () => { return ( <div> <p>Selected dates count: {selectedDates.length}</p> <drayman-year-calendar selectedDates={selectedDates} year={2025} onDayClick={async ({ date }) => { if (selectedDates.includes(date)) { selectedDates = selectedDates.filter((d) => d !== date); } else { selectedDates.push(date); } await forceUpdate(); }} /> </div> ); } }