Configuring the appearance of the Vaadin Calendar component is one of the basic tasks. At the least, you need to consider its sizing in your user interface. You also quite probably want to use some color or colors for events.

The Calendar has a default theme defined in the widget set. You may choose to overwrite the style names from the default theme file calendar.css. The file is located in a folder named public under the src folder in the JAR file. Vaadin will find the CSS from inside the JAR package.

As we saw in Section 16.3.1, “Setting the Date Range”, you can set the range of dates that are shown by the Calendar. But what if you wanted to show the entire month but hide the weekends? Or show only hours from 8 to 16 in the weekly view? The setVisibleDays() and setVisibleHours() methods allow you to do that.

calendar.setVisibleDays(1,5);   // Monday to Friday
calendar.setVisibleHours(0,15); // Midnight until 4 pm

After the above settings, only weekdays from Monday to Friday would be shown. And when the calendar is in the weekly view, only the time range from 00:00 to 16:00 would be shown.

Note that the excluded times are never shown so you should take care when setting the date range. If the date range contains only dates / times that are excluded, nothing will be displayed. Also note that even if a date is not rendered because these settings, the event provider may still be queried for events for that date.