Calendar
Full-featured calendar with month, week, day and agenda views, drag-select, event colouring by category and v-model bindings.
Preview
Rendering the live preview…
month viewRendering the live preview…
week viewRendering the live preview…
agenda viewStructure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-calendar> — 4 visible parts: toolbar ①, weekday header row ②, day-cell grid ③ and event chips ④. The role="application" root handles all keyboard events via a single @keydown handler.- 1.origam-calendar__toolbar
- Navigation and view-switcher toolbar. role="toolbar" with aria-label. Contains prev/today/next BtnGroup and view BtnGroup.
- 2.origam-calendar__weekdays
- Weekday header row. role="row" with columnheader children. Rendered only in month view.
- 3.origam-calendar__month-grid
- Month grid with role="grid". Contains __month-row (role="row") > __day-cell (role="gridcell").
- 4.origam-calendar__event
- Event chip (
API
Props
All props accepted by this component, with their type, default value and description.
- Active view mode: "month", "week", "day" or "agenda". Supports v-model:view.
- currentDateDate | stringnew Date()
- Anchor date. The calendar renders the period containing this date. Supports v-model:currentDate.
- eventsArray<IEvent>[]
- Event list. Recurring events are expanded internally. Each event requires id, title, start and end fields.
- firstDayOfWeek0 | 1 | 2 | 3 | 4 | 5 | 61
- First weekday rendered as the leftmost column. 1 (Monday) for EU/ISO, 0 (Sunday) for US locales.
- Clock format for timeline hour labels: "24h" or "12h".
- localestringnavigator.language
- BCP 47 locale tag driving weekday and month names (e.g. "fr-FR", "en-US").
- selectablebooleantrue
- Enable drag-select on the month grid and timeline slots. Fires range-select and create-event-request emits.
- eventColorKey'category' | 'color' | string'category'
- Which IEvent property to read for colouring. "category" uses categoryColors map; "color" reads the event.color directly.
- categoryColorsRecord<string, TIntent | string>{}
- Map of category string to intent token or CSS colour (e.g. { work: "primary", personal: "success" }).
- weekendHighlightbooleantrue
- Tint Saturday and Sunday cells in month and week views with the surface.sunken background.
- showWeekNumbersbooleanfalse
- Render a leading ISO week-number column. Useful for project or billing calendars.
- dayStartHournumber0
- First hour rendered in week/day timeline views.
- dayEndHournumber24
- Last hour rendered in week/day timeline views.
- slotDurationnumber30
- Minutes per timeline row. 30 for half-hour granularity, 15 for fine-grained drag-create, 60 for compact.
- minDateDate | string
- Lower navigation bound. The prev toolbar button is disabled when the current date would go below this.
- maxDateDate | string
- Upper navigation bound. The next toolbar button is disabled when the current date would exceed this.
- disabledDatesArray<Date | string> | ((d: Date) => boolean)
- Dates to grey out. Accepts an array of Date/ISO strings or a predicate function for dynamic rules.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- color
- Intent or custom foreground color.
- bgColor
- Background color override.
- Border-radius token or boolean.
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- elevationTElevation
- Box-shadow elevation token.
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>false
- Applies a border to the calendar container.
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- Density modifier.
- heightnumber | string
- Calendar container height.
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | string
- Calendar container width.
- paddingboolean | number | string
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
API
Slots
Content slots exposed by this component.
- #header
- Replace the entire toolbar (prev/today/next + title + view switcher).
- #event
- Override event chip / block rendering for every visible event.
- #day
- Override an entire day cell in month view.
- #dayHeader
- Override the day header in week view (weekday name + date number).
- #empty
- Shown in agenda view when there are no events in the visible range.
API
Emits
Events emitted by this component.
- @update:viewTCalendarView
- Fired when the user switches view (month/week/day/agenda). Supports v-model:view.
- @update:currentDateDate
- Fired when the anchor date changes via navigation. Supports v-model:currentDate.
- @event-clickIEvent, MouseEvent
- Fired when the user clicks an event chip or block. Payload: the event object + DOM event.
- @date-clickDate
- Fired when the user clicks an empty day cell.
- @range-selectDate, Date
- Fired when the user finishes a drag-select. Payload: start and end Date of the selection.
- @create-event-requestDate, Date
- Fires alongside range-select as a semantic alias for "user wants to create an event here".
- @view-changeTCalendarView
- Alias of update:view for consumers not using v-model.
- @navigateTCalendarNavigate
- Fired when the user clicks prev / next / today. Payload: "prev", "next" or "today".
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- ComputedRef<{ start: Date; end: Date }>
- Start and end Date of the currently rendered period (useful for fetching remote events).
- ComputedRef<IEvent[]>
- Events after recurring expansion within the visible date range.
- (direction: TCalendarNavigate) => void
- Programmatically navigate: "prev", "next" or "today".
- (view: TCalendarView) => void
- Programmatically switch the view mode.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Calendar background.
- Default text color.
- Container border color.
- Container border-radius.
- Month-view day cell height.
- Background of today's cell.
- Background of weekend cells when weekendHighlight=true.
- Default event chip background.
- Toolbar background.
- Height per timeline slot row (proportional to slotDuration).
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | Action |
|---|---|
| Arrow keys | Navigate between day cells in month view or seek in timeline views. |
| Tab | Move focus between toolbar controls and day cells. |
| Enter / Space | Activate a focused day cell (fires date-click) or event button (fires event-click). |
Notes
- role="application" is used on the root to indicate rich interactive content to assistive technologies. The @keydown handler manages arrow navigation.
- Month view uses role="grid" / role="row" / role="gridcell" for full grid semantics. Week numbers use role="rowheader".
- Each event button has an aria-label describing the event title and time range.
- Disabled day cells receive aria-disabled="true". Drag-select is prevented on disabled cells.
- Today's cell is identified visually with a primary background tint. Consumers should add aria-label="Today" via the #day slot for full AT support.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- colorvar(--origam-color__surface---default)
- Calendar background.
- dimension120px
- Month-view day cell height.
- colorvar(--origam-color__action--primary---bgSubtle)
- Today cell background.
- colorvar(--origam-color__action--primary---bg)
- Default event background.
- fontWeightvar(--origam-font__weight---semibold)
- Toolbar title font weight.
- dimension32px
- Timeline slot row height.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Basic calendar
Category color mapping
Custom event slot