[]previous and next page

IndexProps

Props of Index.

Props of Index.

Import#

ts
import type { IndexProps } from "@shadow-js/web";

Signature#

ts
interface IndexProps<T> {
  /**
   * The list to render. `null`, `undefined` and `false` count as an empty list. Read lazily, 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;
  /**
   * Called once per position, untracked. The item is an accessor that follows the value at this
   * position; the index is a plain number, because a position never changes.
   */
  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, so it is tracked.
fallback? readonly fallback?: unknown Shown while the list is empty. Read lazily.
children readonly children: (item: () => T, index: number) => unknown Called once per position, untracked. The item is an accessor that follows the value at this position; the index is a plain number, because a position never changes.