Fragiola

API: primitives (@fragiola/calendar-react)

Calendar.DayEvents

A day's list of events in a day grid. It calls your function per segment that starts in the day and holds the row's lanes.

Calendar.DayEvents is a day's list of events (role="list"). It renders a div and calls your function for each segment that starts in its day, in lane order; you render a Calendar.Segment.

Behaviour

  • It is its segments' containing block (position: relative): each Calendar.Segment places itself in its lane (--calendar-lane-size high, default 1.5rem) and over its days.
  • It holds the row's lanes (min-block-size: the row's lanes times --calendar-lane-size), so every day of a row is as tall and a multi-day segment lines up across them.
  • With dayMaxEvents: "auto" the engine measures it to decide how many lanes fit: it holds no lanes of its own then, so give it the day's room (flex: 1 in a column) and a row that keeps its height.
  • It calls the function again for a segment whose object changed, and for every segment when the function itself is a new one (React's contract).

It renders data-calendar-part="day-events" and data-date.

Usage

import { Calendar, type DayCell } from "@fragiola/calendar-react";

function MonthDay({ day }: { day: DayCell }) {
    return (
        <Calendar.Day day={day} className="day">
            <Calendar.DayEvents className="day-events">
                {(segment) => (
                    <Calendar.Segment segment={segment} className="chip" />
                )}
            </Calendar.DayEvents>
        </Calendar.Day>
    );
}
.month {
    --calendar-lane-size: 1.375rem;
    --calendar-day-gap: 1px;
}

Props

DayEventsProps; it also takes the common props and every div attribute.

In Vue: the same props (in kebab-case in a template), and slots in place of children; see Vue primitives.

In Angular: a directive on your element, the props as its inputs, templates in place of children; see Angular primitives.

proptypedescription
children(segment: Segment) => ReactNodecalled per segment that starts in the day; render a Calendar.Segment

State

DayEventsState:

fieldtypedescription
segmentsreadonly Segment[]the segments that start in the day