Skip to content

Commit

Permalink
Merge pull request #85 from iway1/more-docs
Browse files Browse the repository at this point in the history
Updates Form Component docs and complex field docs
  • Loading branch information
iway1 authored Mar 12, 2023
2 parents 6fbd5de + 7c6dcaf commit 90cc24d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
6 changes: 0 additions & 6 deletions www/docs/docs/usage/complex-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ const FormSchema = z.object({
});
```

<p align="center">This allows you to build stuff like this when your designer decides to go crazy:</p>

<p align="center">
<img width="60%" src="https://user-images.githubusercontent.com/12774588/210149773-e680c127-9865-4ea1-9b82-1b7e2244c0ef.png"/>
</p>

## ⚠️ When to use ⚠️

Complex input types are useful when you have reusable input components that have a non-primitive object as its form state. If you only need to build a custom layout, use the [Custom Layouts](./custom-layouts.md) feature of this package.
10 changes: 4 additions & 6 deletions www/docs/docs/usage/form-components.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
---
sidebar_position: 7
---

# Form Components

## Customizing form components
## Props

By default your form is just rendered with a `<form>` tag. You can pass props to it via `formProps`:

Expand All @@ -16,7 +12,9 @@ By default your form is just rendered with a `<form>` tag. You can pass props to
/>
```

You can also provide a custom form component as the second parameter to `createTsForm` options if you want, it will get passed an `onSubmit` function, and it should also render its children some where:
## Custom Form Component

The recommended approach is to provide a custom form component as the second parameter to `createTsForm` options, it will get passed an `onSubmit` function, and it should also render its children (these are your input components):

```tsx
const mapping = [
Expand Down

1 comment on commit 90cc24d

@vercel
Copy link

@vercel vercel bot commented on 90cc24d Mar 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.