[]previous and next page

SlotChoice

The choice a branch slot (Show, Switch) shows: its index, and what decides a rebuild.

The choice a branch slot (Show, Switch) shows: its index, and what decides a rebuild. Renderers extend it with what they need to build the branch.

Import#

ts
import type { SlotChoice } from "@shadow-js/core/extend";

Signature#

ts
interface SlotChoice {
  /** Which branch is chosen: its position among the slot's branches, or the renderer's fallback index. */
  readonly index: number;
  /** True when the branch is rebuilt whenever `when` changes identity; false when only `index` counts. */
  readonly keyed: boolean;
  /** The condition value that selected the branch. */
  readonly when: unknown;
}

Members#

Name Type Description
index readonly index: number Which branch is chosen: its position among the slot's branches, or the renderer's fallback index.
keyed readonly keyed: boolean True when the branch is rebuilt whenever when changes identity; false when only index counts.
when readonly when: unknown The condition value that selected the branch.