Skip to content

Commit

Permalink
docs: Add reference docs for react hook form (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Jun 19, 2024
1 parent 7b8dbb7 commit 736f8ce
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
7 changes: 7 additions & 0 deletions apps/www/pages/reference/_meta.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
export default {
"-- integrations": {
title: "Integrations",
type: "separator",
},
integrations: {
display: "children",
},
"-- primitives": {
title: "Primitives",
type: "separator",
Expand Down
3 changes: 3 additions & 0 deletions apps/www/pages/reference/integrations/_meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
"react-hook-form": "React Hook Form",
};
37 changes: 37 additions & 0 deletions apps/www/pages/reference/integrations/react-hook-form.mdx
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,
}
});
```
2 changes: 0 additions & 2 deletions apps/www/pages/reference/primitives/composition.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Composition
---

{/** https://github.com/liveblocks/liveblocks/blob/main/LICENSE */}

import { Code } from "@radix-ui/themes";

`assistant-ui` primitives are composable. This means that all props are forwarded, classes are merged, and event handlers are chained.
Expand Down

0 comments on commit 736f8ce

Please sign in to comment.