Fragiola

API: primitives (@fragiola/calendar-react)

Calendar.ColumnEvents

A day's timed events as a list positioned over its column, calling your function once per timed segment of the day.

Calendar.ColumnEvents is the list of a day's timed events, inside a Calendar.Column: a div with role="list" and data-date, laid over the column (position: absolute; inset: 0, the containing block of the events' percentages). It calls its children function once per timed segment of the day, usually a Calendar.TimeEvent.

Behaviour

  • A list inside the column's gridcell: Enter on a focused slot moves the focus to the events that start in it, Up and Down move between them, Escape returns to the slot.
  • The segments come from the time grid's overlap layout: a multi-day timed event is split per column; overlapping events share the width by their column, columns and span.
  • A segment's call runs again only when the segment object or the children function changes. See Performance.

Usage

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

function TimedEvent(props: { segment: TimeSegment }) {
    const { model } = useCalendar();
    const title = model.get("event-by", { id: props.segment.eventId })?.title;
    return (
        <Calendar.TimeEvent segment={props.segment} className="event">
            {title}
        </Calendar.TimeEvent>
    );
}

export function Events() {
    return (
        <Calendar.ColumnEvents className="events">
            {(segment) => <TimedEvent segment={segment} />}
        </Calendar.ColumnEvents>
    );
}

The title is model data: the event component reads it, the library renders no text.

Attributes

attributevalue
data-calendar-partdata-calendar-part="column-events"
data-dateits day, YYYY-MM-DD
rolelist
styleposition: absolute; inset: 0 (structural)

Props

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.

ColumnEventsProps takes the common props and any div attribute, and:

proptypedescription
children(segment: TimeSegment) => ReactNodecalled per timed segment of the day (<Calendar.TimeEvent segment={segment} />)

State

ColumnEventsState:

fieldtypedescription
segmentsreadonly TimeSegment[]the column's timed segments