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): eachCalendar.Segmentplaces itself in its lane (--calendar-lane-sizehigh, default1.5rem) and over its days. - It holds the row's lanes (
min-block-size: the row'slanestimes--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: 1in 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.
| prop | type | description |
|---|---|---|
children | (segment: Segment) => ReactNode | called per segment that starts in the day; render a Calendar.Segment |
State
DayEventsState:
| field | type | description |
|---|---|---|
segments | readonly Segment[] | the segments that start in the day |