ilokesto

Repeat

Repeat renders children(index) times times. It renders fallback when times is not a positive integer.

import { Repeat } from '@ilokesto/utilinent';

<Repeat times={3}>{(index) => <SkeletonCard key={index} />}</Repeat>

Props

PropTypeDescription
timesnumberMust be a positive integer to render children.
children(index) => ReactNodeCalled once for each index from 0 to times - 1.
fallbackReactNodeRendered for invalid or non-positive counts.

Tag form

<Repeat.ul times={5} aria-label="loading rows">
  {(index) => <li key={index}>Loading row {index + 1}</li>}
</Repeat.ul>

Use Repeat for skeletons, placeholder stars, fixed grid slots, or repeated decorative elements.

On this page