ForKeyedProps
Props of For with key: rows are matched by key(item).
Props of For with key: rows are matched by key(item).
Import#
ts
import type { ForKeyedProps } from "@shadow-js/web";
Signature#
ts
interface ForKeyedProps<T> {
/**
* The list to render. `null`, `undefined` and `false` count as an empty list. Read lazily, inside
* the list memo, so it is tracked.
*/
readonly each: readonly T[] | null | undefined | false;
/**
* Shown while the list is empty. Read lazily.
* @default undefined (an empty list renders nothing)
*/
readonly fallback?: unknown;
/** Identifies each item. A new object under the same key updates the row's `item()`. */
readonly key: (item: T) => unknown;
/** Called once per row, untracked. The callback receives an accessor of the item. */
readonly children: (item: () => T, index: () => number) => unknown;
}
Members#
| Name | Type | Description |
|---|---|---|
T |
T |
|
each |
readonly each: readonly T[] | null | undefined | false |
The list to render. null, undefined and false count as an empty list. Read lazily, inside the list memo, so it is tracked. |
fallback? |
readonly fallback?: unknown |
Shown while the list is empty. Read lazily. |
key |
readonly key: (item: T) => unknown |
Identifies each item. A new object under the same key updates the row's item(). |
children |
readonly children: (item: () => T, index: () => number) => unknown |
Called once per row, untracked. The callback receives an accessor of the item. |