Skip to content

Styling ​

The primitives ship no CSS. They render the structure, roles, and ARIA attributes, and describe everything else in two ways:

  • State as data attributes, present (data-today="") or absent. With Tailwind, style them with data-today:bg-primary; elsewhere, with [data-today] { … }.
  • Layout as CSS custom properties, like --event-span or --event-start. The primitives never set geometry themselves, so you decide how a bar's span or an event's minutes become width and top.

The only inline styles are those custom properties, and the visually hidden live region on CalendarRoot.

Patterns ​

Events sit inside their cell. A month bar renders inside the gridcell of the day it starts, and spans across with --event-span, so the ARIA grid stays intact and screen readers find events in their day. Position bars absolutely in a relative cell:

html
<EventBar
    class="absolute top-[calc(2rem+var(--event-lane)*1.625rem)] h-6 w-[calc(var(--event-span)*100%)]"
/>

Style content from the event's state. State attributes sit on the event primitive itself. Content in its slot reads them with Tailwind's in-* variant, like in-data-highlighted:bg-primary/20, or with [data-highlighted] .title in plain CSS. Cells work the same way with group and group-data-today:.

Highlighting is shared. Hovering or focusing any piece of an event (each week of a multi-week bar, each day of an overnight event) sets data-highlighted on every piece.

Make touch targets bigger. On touch, a long press picks up an event or starts a selection, so a swipe still scrolls. Handles sized for a mouse are too small for a finger: widen them with Tailwind's pointer-coarse: variant, like w-1.5 pointer-coarse:w-3. iOS opens a callout on a long-pressed link or image, which only CSS can stop, so give editable events select-none and [-webkit-touch-callout:none].

State attributes ​

Events ​

EventBar (also exported as MonthEvent), TimeEvent, TimelineEvent, and GanttBar.

AttributeSet whenOn
data-event-idAlways: the event's id.all
data-pastIt ended before now (timed) or before today (all-day).all
data-highlightedThe pointer or focus is on any piece of the same event.all
data-editableThe calendar is editable and can-edit allows this event.all
data-draggingIt's being moved or resized, by pointer or keyboard. On touch, from the long press.all
data-all-dayIt's an all-day event.EventBar, TimelineEvent
data-continues-beforeThis piece isn't the start: it began in an earlier week, or before the visible range.EventBar, GanttBar
data-continues-afterThis piece isn't the end.EventBar, GanttBar
data-starts-beforeIt began before this day's (or row's) visible window.TimeEvent, TimelineEvent
data-ends-afterIt continues past the visible window.TimeEvent, TimelineEvent

EventResizeHandle renders only for editable events, with data-edge="start" or "end".

Days and cells ​

AttributeSet whenOn
data-dateAlways: the ISO date, like 2026-10-14.MonthDay, ResourceCell, TimeColumn
data-todayIt's today.MonthDay, ResourceCell, ResourceDayHeader, TimeColumn
data-weekendIt's a Saturday or Sunday.the above, and MonthWeekday
data-outsideIt belongs to the previous or next month.MonthDay
data-focusedIt's the grid's focus position (the one cell with tabindex=0).MonthDay, ResourceCell, TimeColumn
data-selectedIt's inside the range being selected.MonthDay, ResourceCell
data-overflowSome of its events are hidden behind "+N more"; on a week, it needs more lanes than max-lanes.MonthDay, MonthWeek
data-busyIt has at least one event.ResourceCell
data-overlapTwo of its events are booked at the same time, like a double-booked technician. Timed events count only when their times overlap; an all-day event overlaps anything on its days.ResourceCell, and ResourceRow when any day does

Rows and containers ​

AttributeSet whenOn
data-viewAlways: month, week, or day.CalendarRoot
data-actionAlways: prev, next, or today.CalendarNav
data-currentIt's the today button and today is already in view.CalendarNav
data-unassignedIt's the row for events with no matching resource. A timeline without resources has one row, and it isn't marked.ResourceRow, TimelineRow
data-idleIt has no events in the visible range.ResourceRow, TimelineRow
data-scaleAlways: day, week, or month.Gantt

Attributes like data-drop, data-resource-id, data-axis-start, and data-row-event-id are how drag and drop finds its targets. They're stable, but they're plumbing, not styling hooks.

CSS custom properties ​

Month and resources ​

PropertyMeaningOn
--event-columnThe bar's first day, as a column from 0.EventBar
--event-spanHow many days the bar covers in this week (or range).EventBar
--event-laneIts stacking lane, from 0.EventBar
--week-lanesLanes the week draws, including the "+N more" lane.MonthWeek
--week-visible-lanesLanes of bars, where "+N more" goes.MonthWeek
--day-countDays in the range, for sizing columns.ResourceGrid
--row-lanesLanes the row needs (at least 1), for its height.ResourceRow

Time grid ​

The -offset and -length properties are percentages of the visible window, ready for top and height. The minute properties count from the top of the window (slot-min-minutes), for anything the percentages don't cover.

PropertyMeaningOn
--day-countColumns shown: 7 for a week, 1 for a day.TimeGrid
--window-minutesMinutes in each day's visible window.TimeGrid
--all-day-lanesLanes in the all-day row.TimeGrid
--event-offsetWhere it starts, as a percentage.TimeEvent
--event-lengthHow long it runs, as a percentage.TimeEvent
--event-startWhere it starts, in minutes.TimeEvent
--event-endWhere it ends, in minutes.TimeEvent
--event-columnIts column among overlapping events, from 0.TimeEvent
--event-columnsHow many columns its overlap cluster shares.TimeEvent
--now-offsetThe current time, as a percentage.NowIndicator
--nowThe current time, in minutes.NowIndicator
--selection-offsetThe selection's start, as a percentage.TimeSelection
--selection-lengthThe selection's length, as a percentage.TimeSelection
--selection-startThe selection's start, in minutes.TimeSelection
--selection-endThe selection's end, in minutes.TimeSelection

Timeline ​

The -offset and -length properties are percentages of the whole axis, ready for left and width. Minutes here are along the axis too: each day contributes one window of --window-minutes.

PropertyMeaningOn
--axis-minutesLength of the axis, in minutes.Timeline
--window-minutesMinutes per day on the axis.Timeline
--slot-minutesMinutes per header slot.Timeline
--slot-countHeader slots across the axis.Timeline
--row-lanesLanes the row needs (at least 1).TimelineRow
--event-offsetWhere it starts, as a percentage.TimelineEvent
--event-lengthHow long it runs, as a percentage.TimelineEvent
--event-startWhere it starts, in axis minutes.TimelineEvent
--event-endWhere it ends, in axis minutes.TimelineEvent
--event-laneIts stacking lane, from 0.TimelineEvent
--now-offsetThe current time, as a percentage.TimelineNow
--nowThe current time, in axis minutes.TimelineNow
--selection-offsetThe selection's start, as a percentage.TimelineSelection
--selection-lengthThe selection's length, as a percentage.TimelineSelection
--selection-startThe selection's start, in axis minutes.TimelineSelection
--selection-endThe selection's end, in axis minutes.TimelineSelection

Gantt ​

PropertyMeaningOn
--axis-daysDays on the axis.Gantt
--bar-offsetWhere the bar starts, as a percentage of the axis.GanttBar
--bar-lengthHow long it runs, as a percentage of the axis.GanttBar
--bar-startWhere the bar starts, in days from the axis start.GanttBar
--bar-endWhere it ends, in days (exclusive).GanttBar
--today-offsetWhere today starts, as a percentage of the axis.GanttToday
--today-lengthOne day, as a percentage of the axis.GanttToday
--todayToday, in days from the axis start.GanttToday

Released under the MIT License.