Fragiola

API: primitives (@fragiola/calendar-react)

Calendar.ListDay

A list view's day, a list of its events under the heading you render before it, calling your function once per event of the day.

Calendar.ListDay is one day of a list view: a div with role="list" and data-date, holding the day's events. It calls its children function once per occurrence of the day, usually a Calendar.ListEvent. The day's heading is yours, rendered before it; name the list with it (aria-labelledby).

Behaviour

  • A list per day: its items are listitems, each a tab stop of its own.
  • The items are the day's occurrences in the settings' eventOrder; an event over several days is an item of each of its days (continuesBefore, continuesAfter).
  • An item's call runs again when the item object or the children function changes. See Performance.

Usage

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

export function Day(props: { day: ListDay }) {
    const id = `day-${props.day.date}`;
    return (
        <>
            <h3 id={id}>{props.day.date}</h3>
            <Calendar.ListDay
                day={props.day}
                aria-labelledby={id}
                className={({ today }) => (today ? "events events-today" : "events")}
            >
                {(item) => (
                    <Calendar.ListEvent item={item}>
                        {item.allDay ? "All day" : null} {item.eventId}
                    </Calendar.ListEvent>
                )}
            </Calendar.ListDay>
        </>
    );
}

Attributes

attributevalue
data-calendar-partdata-calendar-part="list-day"
data-dateits day, YYYY-MM-DD
rolelist

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.

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

proptypedescription
dayListDaythe day, from Calendar.ListDays' children function
children(item: ListItem) => ReactNodecalled per occurrence of the day (<Calendar.ListEvent item={item} />)

State

ListDayState:

fieldtypedescription
dayListDaythe day as the list layout gives it (date, today, past, items)
todaybooleanthe day is today