Skip to content

Commit

Permalink
Merge pull request #5923 from WiXSL/fix-selectfield-ref
Browse files Browse the repository at this point in the history
[Doc] Fix SelectField definition
  • Loading branch information
djhi committed Feb 16, 2021
2 parents 0d963d0 + 9444d47 commit e88978e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/Fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ import { SelectField } from 'react-admin';

| Prop | Required | Type | Default | Description |
| ----------------- | -------- | ----------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `choices` | Required | `Object[]` | - | List of items to show as options |
| `optionText` | Optional | `string | Function | Element` | 'name' | Name of the field to use to display the matching choice, or function returning that field name, or a React element to render for that choice |
| `optionValue` | Optional | `string` | 'id' | Name of the field to compare to the value to find the matching choice |
| `translateChoice` | Optional | `boolean` | `true` | Whether or not the choice text should be translated |
Expand All @@ -576,10 +577,10 @@ import { SelectField } from 'react-admin';

#### Usage

By default, the text is built by:
By default, the option is built by:

- finding a choice where the 'id' property equals the field value
- using the 'name' property and the option text
- finding a choice where the `id` property equals the field value
- using the `name` property as the option text

You can also customize the properties to use for the lookup value and text, thanks to the `optionValue` and `optionText` attributes.

Expand Down

0 comments on commit e88978e

Please sign in to comment.