ForProps
Props of For: the items, the row each renders, and what shows while there are none.
Verwendung
Render a short checklist
Dieser Typ wird verwendet von For
import { For, Scroll, Text, store } from 'kuito';
export function PackingList() {
const state = store({ items: [{ title: 'Passport' }, { title: 'Tickets' }] });
return (
<Scroll>
<For each={state.items} fallback={<Text>Add your first item</Text>}>
{(item, index) => <Text padding={12}>{`${index.value + 1}. ${item.title}`}</Text>}
</For>
</Scroll>
);
}Typdeklaration
export interface ForProps<T> extends ElementAttributes {
/** The items: an array, a signal of one, or a store array. */
each: readonly T[] | ReadonlySignal<readonly T[]>;
/** Rendered while `each` is empty. */
fallback?: KuitoNode;
/** Renders an item's row once; `index` follows its position. */
children: (item: T, index: ReadonlySignal<number>) => KuitoNode;
}Mitglieder 4
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
each | readonly T[] | ReadonlySignal<readonly T[]> | Ja | The items: an array, a signal of one, or a store array. |
fallback | KuitoNode | Nein | Rendered while each is empty. |
children | (item: T, index: ReadonlySignal<number>) => KuitoNode | Ja | Renders an item's row once; index follows its position. |
key | string | number | Nein | — |
children — Methodensignaturen
Signaturen
(item: T, index: ReadonlySignal<number>): KuitoNodeParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
item | T | Ja | — |
index | ReadonlySignal<number> | Ja | — |
Rückgabe
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.