Askr documentation
Generated API snapshot

@askrjs/askr/control

Exports from the declarations published in @askrjs/askr. Signatures reflect the published artifact.

Exports

This entrypoint publishes 8 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.

Casetype

Case: (props: CaseProps) => JSXElement

Render the first matching {@link Match} child (by `when`), or `fallback` if none match.

CasePropstype

CaseProps: {
  fallback?: BoundaryChild;
  children?: unknown;
}

Props for {@link Case}.

children
children?: unknown;
fallback
fallback?: RenderableChild;

Fortype

For: <T, K extends string | number = string | number>(props: ForProps<T, K>) => JSXElement

Render a keyed or indexed list, reconciling items by key instead of position.

ForPropstype

ForProps: KeyedForProps<T, K> | IndexedForProps<T>

Props for {@link For}.

by
by?: ((item: T, index: number) => K) | undefined;
byIndex
byIndex?: true | undefined;
children
Row renderer. Parent reactive reads must use `selector()` or thunk props; closure-captured values are snapshotted when the row is created or reconciled; changing the parent source does not rerun an existing row.
each
each: ForEachSource<T>;
fallback
fallback?: RenderableChild;

Matchtype

Match: (_props: MatchProps) => null

Declares one branch of a {@link Case}; only valid as its direct child.

MatchPropstype

MatchProps: {
  key?: string | number | null;
  when: unknown;
  children: MatchChild;
}

Props for {@link Match}, valid only as a direct child of {@link Case}.

children
children: MatchChild;
key
key?: string | number | null | undefined;
when
when: unknown;

Showtype

Show: <T>(props: ShowProps<T>) => JSXElement

Conditionally render children based on `when`, narrowing truthy values for the render function form.

ShowPropstype

ShowProps: {
  when: ShowSource<T>;
  fallback?: BoundaryChild;
  children: BoundaryChild | ((value: Truthy<T>) => BoundaryChild);
}

Props for {@link Show}.

children
children: RenderableChild | ((value: Truthy<T>) => BoundaryChild);
fallback
fallback?: RenderableChild;
when
when: ShowSource<T>;