Skip to content

Commit 6ea84d4

Browse files
committed
docs: add documentation for labelFn of SimpleFormIterator
1 parent 856a15a commit 6ea84d4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/Inputs.md

+13
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,19 @@ import { ArrayInput, SimpleFormIterator, DateInput, TextInput } from 'react-admi
12111211
</ArrayInput>
12121212
```
12131213

1214+
Furthermore, if you want to customize the label displayed for each item, you can pass a function to `SimpleFormIterator` via the `labelFn` prop.
1215+
1216+
```jsx
1217+
import { ArrayInput, SimpleFormIterator, DateInput, TextInput } from 'react-admin';
1218+
1219+
<ArrayInput source="backlinks">
1220+
<SimpleFormIterator labelFn={(index) => `${index + 1}. link`}>
1221+
<DateInput source="date" />
1222+
<TextInput source="url" />
1223+
</SimpleFormIterator>
1224+
</ArrayInput>
1225+
```
1226+
12141227
**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:
12151228

12161229
```jsx

0 commit comments

Comments
 (0)