Fragiola

Concepts

State attributes

Every element names its part and shows its state as data attributes and ARIA, present or absent, so any CSS tool can style the calendar.

The parts render no class names. Instead every element says what it is, with data-calendar-part, and what state it is in, with data-* attributes and ARIA. A boolean state is present or absent (data-today="", never data-today="false"), so a selector is just the attribute: [data-today], .day[data-outside], data-today:font-semibold in Tailwind.

[data-calendar-part="day"][data-outside] { opacity: 0.5; }
[data-calendar-part="day"][data-today] .day-number { font-weight: 600; }
[data-calendar-part="time-event"][data-dragging] { opacity: 0.4; }
[data-calendar-part="slot"][data-selected] { background: #dbeafe; }

The attributes come from the core (partAttributes, and the engine's), so every framework's parts set the same ones.

Parts

data-calendar-part names each element:

partelementrole
rootCalendar.Root (with data-view)
previous, next, todayCalendar.Previous, Calendar.Next, Calendar.Todaybutton
view-buttonCalendar.ViewButton (aria-pressed)button
day-gridCalendar.DayGridgrid
column-headersCalendar.ColumnHeadersrow
column-headerCalendar.ColumnHeadercolumnheader
weekCalendar.Weekrow
week-numberCalendar.WeekNumberrowheader
dayCalendar.Daygridcell
day-eventsCalendar.DayEventslist
segmentCalendar.Segment: an event in a day gridlistitem
moreCalendar.More: a day's "+N more"button
time-gridCalendar.TimeGridgrid
all-day-rowCalendar.AllDayRowrow
scrollerCalendar.Scroller
slot-rowCalendar.SlotRow (with data-time)row
slot-labelCalendar.SlotLabel (with data-time)rowheader
slotCalendar.Slotgridcell
columnsCalendar.Columnsrow
columnCalendar.Columngridcell
column-eventsCalendar.ColumnEventslist
time-eventCalendar.TimeEvent: an event in a time gridlistitem
listCalendar.List
list-dayCalendar.ListDaylist
list-eventCalendar.ListEvent: an event in a listlistitem
selectionSelection (/selection)aria-hidden
drag-previewDragPreview (/drag-and-drop, /resize)aria-hidden
resize-handleResizeHandle (/resize, with data-edge)aria-hidden
now-indicatorNowIndicator (/now-indicator)aria-hidden
business-hoursBusinessHours (/constraints)aria-hidden

An event is one entity with three parts, named where it shows: segment, time-event or list-event.

Positions

attributeonvalue
data-viewthe rootthe view's type: month, week, day, days, list
data-datedays, column headers, slots, columns, day and column events, list days, "+N more", the now indicatorYYYY-MM-DD
data-timeslot rows, slot labels, slots, the now indicatorHH:mm
data-event-ideventsthe event's id
data-occurrence-idevents, resize handlesthe occurrence's id (<eventId>@<original start> for a recurring one)
data-calendar-ideventsthe event's calendar (category)
data-edgeresize handlesstart or end

State

attributeonpresent when
data-todaydays, column headers, columnsit is today, in the display zone
data-pastdays, column headers, columnsit is before today
data-outsidedays of a monthit is outside the month the view is about
data-weekenddays, column headers, columnsit is a weekend day of the locale
data-disableddays, slots, columns; navigation buttonsoutside validRange; the button's command cannot run
data-pressedview buttonsits view is the one shown
data-focuseddays, slots, eventsit holds the roving focus
data-all-dayeventsthe event is all-day
data-continues-beforeeventsit started before this row, column or day
data-continues-aftereventsit ends after this row, column or day
data-selecteddays, slotsinside the selected range (selection())
data-draggingeventsa pointer drags it (dragAndDrop())
data-grabbedeventsthe keyboard grabbed it (dragAndDrop(), resize())
data-resizingeventsa pointer resizes it (resize())
data-business-hoursdays, slotswithin the business hours (constraints())

ARIA

The engine sets the grid's roles and the roving focus: one element of a grid has tabindex="0" (the tab stop), the others -1. Calendar.ViewButton sets aria-pressed; the decorations (Selection, DragPreview, ResizeHandle, NowIndicator, BusinessHours) are aria-hidden. The names are yours (Accessible names and the keyboard).

The date cells say their state in ARIA too:

  • today's day (and a time grid's header of today) has aria-current="date";
  • with selection() installed, every day and slot has aria-selected ("true" inside the selected range) and the grid aria-multiselectable="true";
  • a day or a slot outside validRange has aria-disabled="true".

A month's column headers stand for weekdays: they carry data-date (a date of that weekday) and data-weekend, never the first row's day state. A time grid numbers its columns: the grid has aria-colcount (the days plus the time axis), each cell aria-colindex (the axis is column 1, the days from 2), so the header row, the all-day row and the columns' layer need no cell of yours for the axis. A month numbers its columns when its rows render a week number and the root says so (weekNumberColumn): the grid's aria-colcount counts the week numbers' column, each week number is column 1 and the days and their headers from 2, so the header row of seven and the rows of eight agree.