-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add reference docs for react hook form (#242)
- Loading branch information
Showing
4 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
"react-hook-form": "React Hook Form", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: "@assistant-ui/react-hook-form" | ||
description: A React Hook Form integration for @assistant-ui. | ||
--- | ||
|
||
## API Reference | ||
|
||
### `useAssistantForm` | ||
|
||
Drop-in replacement hook for `useForm` that adds support for `@assistant-ui/react`. | ||
|
||
```diff | ||
- import { useForm } from "react-hook-form"; | ||
+ import { useAssistantForm } from "@assistant-ui/react-hook-form"; | ||
- useForm({ | ||
+ useAssistantForm({ | ||
... | ||
}); | ||
``` | ||
|
||
{/** TODO document assistant.tools property */} | ||
|
||
### `formTools` | ||
|
||
The set of tools to use with `useAssistantForm`, useful for runtimes that do not support client-side tool definitions (i.e. Vercel AI SDK). | ||
|
||
```tsx {1, 5-7} | ||
import { formTools } from "@assistant-ui/react-hook-form"; | ||
const result = await streamText({ | ||
... | ||
tools: { | ||
...formTools, | ||
} | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters