Skip to content

Commit

Permalink
[Doc] Add link to video tutorial for <SelectInput onCreate>prop
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed Feb 21, 2024
1 parent 6b3976a commit 5e2ed7d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/SelectInput.md
Expand Up @@ -304,6 +304,8 @@ const UserCountry = () => {

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.

<iframe src="https://www.youtube-nocookie.com/embed/CIUp5MF6A1M" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen style="aspect-ratio: 16 / 9;width:100%;margin-bottom:1em;"></iframe>

{% raw %}
```js
import { SelectInput, Create, SimpleForm, TextInput } from 'react-admin';
Expand Down Expand Up @@ -586,6 +588,8 @@ This is the recommended approach for using `<SelectInput>` to select a foreign k

The `<SelectInput>` can allow users to create a new choice if either the `create` or `onCreate` prop is provided.

<iframe src="https://www.youtube-nocookie.com/embed/CIUp5MF6A1M" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen style="aspect-ratio: 16 / 9;width:100%;margin-bottom:1em;"></iframe>

Use the `onCreate` prop when you only require users to provide a simple string and a `prompt` is enough. You can return either the new choice directly or a Promise resolving to the new choice.

{% raw %}
Expand Down

0 comments on commit 5e2ed7d

Please sign in to comment.