Skip to content

Commit

Permalink
docs: add documentation for labelFn of SimpleFormIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
iamstiil committed Jun 4, 2021
1 parent 856a15a commit 5cfe4b7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/Inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,19 @@ import { ArrayInput, SimpleFormIterator, DateInput, TextInput } from 'react-admi
</ArrayInput>
```

Furthermore, if you want to manipulate the label displayed left of each item, you can pass a function to `SimpleFormIterator` via the `labelFn` prop.

```jsx
import { ArrayInput, SimpleFormIterator, DateInput, TextInput } from 'react-admin';

<ArrayInput source="backlinks">
<SimpleFormIterator labelFn={(index) => `${index + 1}. link`}>
<DateInput source="date" />
<TextInput source="url" />
</SimpleFormIterator>
</ArrayInput>
```

**Note**: `SimpleFormIterator` only accepts `Input` components as children. If you want to use some `Fields` instead, you have to use a `<FormDataConsumer>` to get the correct source, as follows:

```jsx
Expand Down

0 comments on commit 5cfe4b7

Please sign in to comment.