File size: 757 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
---
title: For
description: Used to loop over an array and render a component for each item.
links:
source: components/for
storybook: components-for--basic
---
<ExampleTabs name="for-basic" />
## Usage
The `For` component is used to render a list of items in a strongly typed
manner. It is similar to the `.map()`.
```jsx
import { For } from "@chakra-ui/react"
```
```jsx
<For each={[]} fallback={...} />
```
## Examples
### Object
Here's an example of using the `For` component to loop over an object.
<ExampleTabs name="for-with-object" />
### Fallback
Use the `fallback` prop to render a fallback component when the array is empty
or undefined.
<ExampleTabs name="for-with-fallback" />
## Props
<PropTable component="For" part="For" />
|