# UC-027: FullCalendar Themes **As a** Vaadin application developer, **I want to** choose a FullCalendar theme per calendar, from FullCalendar's stock themes or my own, **so that** the calendar has the design I need without loading designs nobody uses. **Status:** Implemented **Date:** 2026-10-07 --- ## Scope **Addon module:** addon (the scheduler inherits it) **Related Options:** — (the theme is not a FullCalendar option, FullCalendar takes it as a plugin) **Related Events:** — --- ## User-Facing Behavior - Each calendar renders with one FullCalendar theme. Default is the FullCalendar Vaadin theme (`FullCalendarTheme.VAADIN`, UC-023). - The five FullCalendar stock themes can be selected: classic, monarch, breezy, forma, pulse. Each comes with its default palette (monarch purple, breezy indigo, forma blue, pulse red, classic its only palette). - The browser loads monarch, breezy, forma and pulse only when a calendar on the page selects them. The FullCalendar Vaadin theme comes with the main module, and with it classic's plugin and stylesheet, on which it builds. Classic's palette loads when a calendar selects classic. - Calendars with different themes can share a page. - The theme can be changed while the calendar is shown. View, date and entries stay. - A developer can register an own FullCalendar theme in the browser under a name and select it from Java like a stock theme. - A name that is not registered logs an error to the browser console. The calendar keeps the theme it had, or shows without a theme if it had none yet. - A theme that fails to load logs an error to the browser console. A calendar that was waiting for it shows without a theme. - Until its initial theme has loaded, a calendar is rendered but invisible, so it never shows unstyled. The default theme needs no load and is shown at once. On a theme change it keeps the previous theme until the new one has loaded. --- ## Java API Usage ```java FullCalendar calendar = new FullCalendar(); // FullCalendar Vaadin theme calendar.setTheme(FullCalendarTheme.MONARCH); calendar.getTheme(); // "monarch" calendar.setTheme("corporate"); // custom theme, registered in the browser ``` Registering a custom theme, in a frontend module the application loads with `@JsModule`: ```ts import {FullCalendar} from 'Frontend/generated/jar-resources/vaadin-full-calendar/full-calendar'; // the loader returns the theme plugin, or a module whose default export is the plugin, // and loads the theme's CSS itself FullCalendar.registerTheme('corporate', () => import('./corporate-theme')); ``` --- ## Business Rules | ID | Rule | |----|------| | BR-01 | Theme names are plain strings. `FullCalendarTheme` holds the names of the themes that come with the add-on. It is no enum, so custom names work the same way. | | BR-02 | `setTheme` rejects `null` (NullPointerException) and blank names (IllegalArgumentException). Any other name is passed to the browser unchanged. | | BR-03 | The theme reaches the browser as the element property `fcTheme`. Flow restores it after detach and reattach. | | BR-04 | Each theme is loaded once per page with a dynamic `import()`, so the frontend build puts it into its own chunk. Later calendars with the same theme reuse it. | | BR-05 | A stock theme's `theme.css` and default palette are imported as text and added as one `