Skip to content
HomePagesHomePages template kit

ItemBinding

One item of a list slot: the list's identity, the item's index — which is also its `data-slot-item` value — and its raw runtime value.

One item of a list slot: the list’s identity, the item’s index — which is also its data-slot-item value — and its raw runtime value. A RECORD item additionally carries fields, one {@link FieldBinding} per declared row field, so each field renders through its own binding.

Plain JSON like every other binding: an item crosses component and island boundaries as an ordinary prop. Slot.Group accepts one directly to mark a list row.

Import from @homepages/template-kit.

export type ItemBinding<D> = {
readonly slot: string;
readonly index: number;
readonly value: ItemValue<D>;
readonly present: boolean;
} & (D extends {
type: "list";
fields: Record<string, unknown>;
} ? {
readonly fields: RowBinding<D>;
} : {
readonly fields?: undefined;
});