Render a short collection while preserving item identity. Use it for tags, checklist rows and small menus.

Show a checklist with row numbers

tsx
import { For, Scroll, Text, store } from 'kuito';

const todo = store({ tasks: [{ title: 'Write', done: false }] });

export default function Tasks() {
  return (
    <Scroll>
      <For each={todo.tasks} fallback={<Text>Nothing to do</Text>}>
        {(task, index) => <Text>{index.value + 1 + '. ' + task.title}</Text>}
      </For>
    </Scroll>
  );
}

Behavior

each accepts an array, array signal or store array. index is a signal. Every item is mounted; choose List when the collection needs virtualization. fallback handles an empty collection.

Continue

Read Control flow for a complete workflow. See the complete prop reference for types and documented defaults.

Reference

Signatures

ts
<T>(props: ForProps<T>): KuitoElement

Type parameters

NameConstraintDefault
T——

Parameters

NameTypeRequiredDescription
propsForProps<T>Yes—

Returns

KuitoElement

Props: ForProps<T>

Props (including inherited props) 4

NameTypeRequiredDescription
eachreadonly T[] | ReadonlySignal<readonly T[]>YesThe items: an array, a signal of one, or a store array.
fallbackKuitoNodeNoRendered while each is empty.
children(item: T, index: ReadonlySignal<number>) => KuitoNodeYesRenders an item's row once; index follows its position.
keystring | numberNo—
children — method signatures

Signatures

ts
(item: T, index: ReadonlySignal<number>): KuitoNode

Parameters

NameTypeRequiredDescription
itemTYes—
indexReadonlySignal<number>Yes—

Returns

KuitoNode

Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.