Skip to content

Commit f04d08d

Browse files
authored
Merge pull request #9016 from marmelab/doc-predictivetextinput
[Doc] Add PredictiveTextInput chapter
2 parents 38ff4a5 + 61c73cb commit f04d08d

7 files changed

+461
-1
lines changed

docs/Features.md

+33
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,39 @@ const CustomerEdit = () => (
678678

679679
And if you want something super custom that react-admin doesn't support out of the box, you can always use [react-hook-form](https://react-hook-form.com/) directly.
680680

681+
## AI-Powered Components
682+
683+
React-admin leverages recent breakthroughs in AI to **boost developer productivity**.
684+
685+
One example is [`<PredictiveTextInput>`](./PredictiveTextInput.md), which suggests completion for the input value, using your favorite AI backend. Users can accept the completion by pressing the `Tab` key. It's like Intellisense or Copilot for your forms.
686+
687+
<video controls autoplay playsinline muted loop>
688+
<source src="./img/PredictiveTextInput.mp4" type="video/mp4"/>
689+
Your browser does not support the video tag.
690+
</video>
691+
692+
Use `<PredictiveTextInput>` in any react-admin form:
693+
694+
```jsx
695+
import { Edit, SimpleForm, TextInput } from 'react-admin';
696+
import { PredictiveTextInput } from '@react-admin/ra-ai';
697+
698+
const PersonEdit = () => (
699+
<Edit>
700+
<SimpleForm>
701+
<TextInput source="firstName" />
702+
<TextInput source="lastName" />
703+
<TextInput source="company" />
704+
<PredictiveTextInput source="email" />
705+
<PredictiveTextInput source="website" />
706+
<PredictiveTextInput source="bio" multiline />
707+
</SimpleForm>
708+
</Edit>
709+
);
710+
```
711+
712+
See [the `<PredictiveTextInput>` documentation](./PredictiveTextInput.md) for more details.
713+
681714
## Optimistic Updates And Undo
682715

683716
When a user edits a record and hits the "Save" button, the UI shows a confirmation and displays the updated data *before sending the update query to the server*. The main benefit is that UI changes are immediate - **no need to wait for the server response**. It's a great comfort for users.

docs/Inputs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ React-admin provides a set of Input components, each one designed for a specific
6262

6363
| Data Type | Example value | Input Components |
6464
|-----------------------|--------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
65-
| String | `'Lorem Ipsum'` | [`<TextInput>`](./TextInput.md) |
65+
| String | `'Lorem Ipsum'` | [`<TextInput>`](./TextInput.md), [`<PredictiveTextInput>`](./PredictiveTextInput.md) |
6666
| Rich text | `<p>Lorem Ipsum</p>` | [`<RichTextInput>`](./RichTextInput.md) |
6767
| Markdown | `# Lorem Ipsum` | [`<MarkdownInput>`](./MarkdownInput.md) |
6868
| Password | `'********'` | [`<PasswordInput>`](./PasswordInput.md) |

0 commit comments

Comments
 (0)