Angular Calendar Component | ng-hub-ui-calendar

Angular calendar component with event views, drag and drop, templates, internationalization and CSS variables for scheduling interfaces.

API reference

Here's the full contract for calendar: everything you can bind, listen to, project and theme, gathered in one place. Wire up what you need and style what you want — it's standalone and signal-friendly.

Inputs

Dial calendar in with 22 inputs. Bind them like any Angular @Input.

NameTypeDefaultDescription
variantstringundefinedSemantic accent for the today / selected day, the active view button and the event chips: primary, secondary, success, danger, warning, info, neutral, light, dark, or any custom name read as --hub-sys-color-<variant>.
eventsCalendarEvent<T>[][]Array of events to display on the calendar
view'month' | 'week' | 'day' | 'year''month'Current view type (two-way binding with viewChange)
selectedDateDatenew Date()Currently focused date (two-way binding with selectedDateChange)
configCalendarConfig{}Configuration options for the calendar
eventClassstring | ((event: CalendarEvent) => string)undefinedCSS class(es) to apply to events, can be static or dynamic
weekStartsOn0 | 1 | 2 | 3 | 4 | 5 | 6 | undefinedundefinedDay the week starts on (0 = Sunday, 1 = Monday, etc.). Overrides config.weekStartsOn when set; left unset, the config decides and its own default is 0.
localestring'en'Language code for the built-in dictionary. English and Spanish ship with the library; any other code falls back to English.
heightnumber | stringundefinedHeight of the calendar, which also decides whether it scrolls or grows. A number is read as pixels; any CSS length works, and `auto` grows to the content instead of scrolling. Left unset the calendar fills its container. Prefer this over a stylesheet rule: a scoped `hub-calendar { … }` selector outranks the component's own layout and can unstack it.
displayFormatIntl.DateTimeFormatOptions | string | ((date: Date) => string)undefinedHow the header title writes the month and year. Takes Intl options, an Angular date pattern such as `MMMM yyyy`, or a function. Unset, the built-in composition is used; the year view, whose title names a year, is left alone.
timeDisplayFormatIntl.DateTimeFormatOptions{ hour: 'numeric', minute: '2-digit' }Intl options for the clock in the chip and day tooltips, composed with `hourFormat`. Defaults to the hour and its minutes.
eventTimeFormatIntl.DateTimeFormatOptions | string | ((date: Date) => string)undefinedThe hour a month-view chip prints in front of a timed event. Unset, it keeps the abbreviation the narrow cell was given: the minutes are dropped when they are zero.
slotLabelFormatIntl.DateTimeFormatOptions | string | ((date: Date) => string)undefinedThe labels down the hour ruler of the week and day views. Unset, they stay the plain `9:00` the ruler has always printed; setting `hourFormat` alone turns them into a real clock.
hourFormat'12' | '24'undefinedForces a 12- or 24-hour clock everywhere the calendar writes one. Unset, the locale decides — the same meaning the option has in `hub-datepicker`.
weekdayFormat'short' | 'narrow' | 'long''short' ('narrow' when compact)Width of the weekday column headers. `short` and `long` read the calendar's own dictionary, so an application dictionary reaches them; `narrow` has no entry there and is derived from the locale.
monthFormat'short' | 'long''long'How the month is written in the header title and on the year view's cards. `long` by default, which is what the calendar has always printed.
yearLayout'cards' | 'days''cards'What the year view draws. `cards` (the default) keeps the month cards with an event count; `days` draws every month as a mini-month with its days and up to three dots per day, one per event covering it.
rangeStartDate | nullnullFirst day of an active period, such as a school year. The year view starts at the month holding it, and in the `days` layout the days of that month before it are disabled. With only this bound the view shows twelve months from it; with neither bound it shows the calendar year of `selectedDate`.
rangeEndDate | nullnullLast day of an active period. The year view ends at the month holding it, and in the `days` layout the days after it are disabled. With only this bound the view shows the twelve months ending at it. A span longer than 24 months is cut to its first 24.
navigationbooleantrueDraws the previous, today and next buttons. Turn it off when your own code picks the period, so the grid cannot drift away from what it shows. The view switcher keeps its own rule, `config.availableViews`.
yearDayClass(day: CalendarDay<T>) => string | null | undefinedundefinedA function that returns extra classes for each day cell of the `days` year layout. The cell reads `--hub-calendar-year-day-bg` and `--hub-calendar-year-day-fg`, so a class can fill the days that matter, such as the days a group has class, without out-ranking the library's own rule.
compactbooleanfalseDraws the calendar as a mini-month: the toolbar goes, the day and week height floors go, the weekday headers narrow to the locale's own initials and a day that holds events carries a dot instead of chips. The month caption stays. `booleanAttribute`-transformed, so the bare `compact` attribute switches it on.

Outputs

React to what calendar does — 7 events to hook your logic onto.

NameTypeDescription
eventClickCalendarEvent<T>Emitted when an event is clicked
dayClickCalendarDay<T>Emitted when a day cell is clicked
dayActivate{ day: CalendarDay<T>; element: HTMLElement }Emitted with `{ day, element }` when a day of the `days` year layout is clicked or activated by keyboard, so you can anchor your own menu to the cell. `dayClick` is emitted too, and the view does not drill into the month.
eventDrop{ event: CalendarEvent<T>; newDate: Date; previousDate: Date }Emitted when an event is dropped on a different day
viewChangeCalendarViewTypeEmitted when the view type changes
selectedDateChangeDateEmitted when the selected date changes; supports two-way binding via [(selectedDate)]
dateChangeDateEmitted when navigation changes the displayed date

Templates

Make it yours — 2 template slots let you project custom markup.

NameDescriptionExample
eventTptTemplate for rendering individual events. Context: { event: CalendarEvent }<ng-template eventTpt let-event="event">{{ event.title }}</ng-template>
dayCellTptTemplate for customizing day cell rendering. Context: { day: CalendarDay }<ng-template dayCellTpt let-day="day">{{ day.date | date }}</ng-template>