Directory

← Back

Year Month Calendar Add-on

Full year / month calendar for Vaadin 22+

Author

Contributors

Rating

This addon can display a whole year calendar in one component.

Features

  • Java API for applying CSS class names to specific dates
  • Selection listener
  • Responsive layout

Sample code

    YearCalendar calendar = new YearCalendar();

    calendar.setClassNameGenerator(date -> {
      if (TestUtils.isPublicHoliday(date)) {
        return "holiday";
      }
      if (date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY) {
        return "weekend";
      }
      return null;
    });

    Span selectedDate = new Span();
    calendar.addDateSelectedListener(ev -> {
      selectedDate.setText("Selected date: " + ev.getDate());
    });

    Span instructions = new Span("Use arrow keys or Ctrl+arrow keys to move.");
    add(new HorizontalLayout(instructions, selectedDate), calendar);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Bug fixes:

  • cleanup CSS styles on empty cells in MonthCalendar (#58)
Released
2023-04-03
Maturity
TESTED
License
Apache License 2.0

Compatibility

Framework
Vaadin 22
Vaadin 23
Vaadin 24 in 3.0.0
Browser
Firefox
Safari
Google Chrome
iOS Browser
Android Browser
Microsoft Edge

Vaadin Add-on Directory

Find open-source widgets, add-ons, themes, and integrations for your Vaadin application. Vaadin Add-on Directory
The channel for finding, promoting, and distributing Vaadin add-ons.
Online