API: primitives (@fragiola/calendar-react)
Calendar.SlotRow
A time grid's row at one time of day, its label and one slot cell per day, marked with the slot's time in data-time.
Calendar.SlotRow is a row of the time grid at one slot: a div with role="row" and
data-time, holding the row's label and a slot per day. Its height (the slot height of your
design) and its lines are yours.
Behaviour
- One row per slot of the APG grid pattern:
a
rowheader(Calendar.SlotLabel), then agridcellper day (Calendar.Slot), the cells of the roving focus. - Up and Down move the focus between rows in a column; the first row's Up reaches the all-day row.
- Children as a function are called per day (the row wraps them in
Calendar.Slots); children as elements let you put the label first.
Usage
import { Calendar, type TimeSlot } from "@fragiola/calendar-react";
export function Row(props: { slot: TimeSlot }) {
return (
<Calendar.SlotRow
slot={props.slot}
className={({ slot }) =>
slot.time.endsWith(":00") ? "row row-hour" : "row"
}
>
<Calendar.SlotLabel>{props.slot.time}</Calendar.SlotLabel>
<Calendar.Slots>
{(column) => <Calendar.Slot date={column.date} />}
</Calendar.Slots>
</Calendar.SlotRow>
);
}The class (a className function of the state in React, read from the slot prop in Vue, from the
let-slot context in Angular) draws a
stronger line on the full hours.
Attributes
| attribute | value |
|---|---|
data-calendar-part | data-calendar-part="slot-row" |
data-time | the slot's start, HH:mm |
role | row |
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.
SlotRowProps takes the common props and any div attribute
(but slot), and:
| prop | type | description |
|---|---|---|
slot | TimeSlot | the slot, from Calendar.SlotRows' children function |
children | ReactNode, or (column: TimeGridColumn) => ReactNode | a function called per day (<Calendar.Slot date={column.date} />), or elements: a Calendar.SlotLabel, then Calendar.Slots |
State
SlotRowState:
| field | type | description |
|---|---|---|
slot | TimeSlot | the slot: its time (HH:mm) and its place in a column (top, height fractions) |