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

New features:

  • Add i18n support to YearMonthField (#64)

Bug fixes:

  • Ignore browser timezone when parsing selected value (#59)
  • Include components in the frontend bundle for production builds (#73)
Released
2023-09-04
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 24
Vaadin 23 in 2.3.1
Vaadin 22 in 2.3.1
Browser
N/A
Online