Options
All
  • Public
  • Public/Protected
  • All
Menu

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>
        );
    }
}

Hierarchy

Index

Properties

Optional onDayClick

onDayClick: ElementEvent<{ date: string }>

Executed when user clicks on a day.

Optional ref

ref: string

Optional selectedDates

selectedDates: string[]

Array of selected dates in YYYY-MM-DD format.

Optional style

style: CSS

Optional year

year: number

The year to display. If not provided, the current year will be used.