Skip to content

Commit 691ab60

Browse files
doc: add InputLabelProps documentation
1 parent 219d07a commit 691ab60

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

docs/SelectArrayInput.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,18 @@ The form value for the source must be an array of the selected values, e.g.
6161

6262
## Props
6363

64-
| Prop | Required | Type | Default | Description |
65-
|-------------------|----------|----------------------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------|
66-
| `choices` | Optional | `Object[]` | - | List of items to show as options. Required unless inside a ReferenceArray Input. |
67-
| `create` | Optional | `Element` | - | A React Element to render when users want to create a new choice |
68-
| `createLabel` | Optional | `string` | `ra.action. create` | The label for the menu item allowing users to create a new choice. Used when the filter is empty |
69-
| `disableValue` | Optional | `string` | 'disabled' | The custom field name used in `choices` to disable some choices |
70-
| `onCreate` | Optional | `Function` | - | A function called with the current filter value when users choose to create a new choice. |
71-
| `options` | Optional | `Object` | - | Props to pass to the underlying `<SelectInput>` element |
72-
| `optionText` | Optional | `string` &#124; `Function` | `name` | Field name of record to display in the suggestion item or function which accepts the current record as argument (`record => {string}`) |
73-
| `optionValue` | Optional | `string` | `id` | Field name of record containing the value to use as input value |
74-
| `translateChoice` | Optional | `boolean` | `true` | Whether the choices should be translated |
64+
| Prop | Required | Type | Default | Description |
65+
|-------------------|----------|----------------------------|--------------- -----|----------------------------------------------------------------------------------------------------------------------------------------|
66+
| `choices` | Optional | `Object[]` | - | List of items to show as options. Required unless inside a ReferenceArray Input. |
67+
| `create` | Optional | `Element` | - | A React Element to render when users want to create a new choice |
68+
| `createLabel` | Optional | `string` | `ra.action. create` | The label for the menu item allowing users to create a new choice. Used when the filter is empty |
69+
| `disableValue` | Optional | `string` | 'disabled' | The custom field name used in `choices` to disable some choices |
70+
| `InputLabelProps` | Optional | `Object` | - | Props to pass to the underlying `<InputLabel>` element |
71+
| `onCreate` | Optional | `Function` | - | A function called with the current filter value when users choose to create a new choice. |
72+
| `options` | Optional | `Object` | - | Props to pass to the underlying `<SelectInput>` element |
73+
| `optionText` | Optional | `string` &#124; `Function` | `name` | Field name of record to display in the suggestion item or function which accepts the current record as argument (`record => {string}`) |
74+
| `optionValue` | Optional | `string` | `id` | Field name of record containing the value to use as input value |
75+
| `translateChoice` | Optional | `boolean` | `true` | Whether the choices should be translated |
7576

7677
`<SelectArrayInput>` also accepts the [common input props](./Inputs.md#common-input-props).
7778

@@ -265,6 +266,16 @@ const choices = [
265266
<SelectArrayInput source="roles" choices={choices} disableValue="not_available" />
266267
```
267268

269+
## `InputLabelProps`
270+
271+
Use the `options` attribute if you want to override Material UI's `<InputLabel>` attributes:
272+
273+
{% raw %}
274+
```jsx
275+
<SelectArrayInput source="category_ids" choices={choices} InputLabelProps={{ shrink: true }} />
276+
```
277+
{% endraw %}
278+
268279
## `onCreate`
269280

270281
Use the `onCreate` prop to allow users to create new options on-the-fly. Its value must be a function. This lets you render a `prompt` to ask users about the new value. You can return either the new choice directly or a Promise resolving to the new choice.

0 commit comments

Comments
 (0)