# useFormBinder

Source code is hosted on [GitHub](https://github.com/corets/use-form-binder)

{% tabs %}
{% tab title="yarn" %}

```bash
yarn add @corets/use-form-binder
```

{% endtab %}

{% tab title="npm" %}

```bash
npm install --save @corets/use-form-binder
```

{% endtab %}
{% endtabs %}

React bindings of vanilla HTML elements for this package:

{% content-ref url="/pages/-MeeF80BrEndyj5EzdPB" %}
[Form](/services/form.md)
{% endcontent-ref %}

## useFormBinder() <a href="#useformbinder" id="useformbinder"></a>

Create an input binder for vanilla HTML input elements:

```typescript
import React from "react"
import { createForm } from "@corets/form"
import { useForm } from "@corets/use-form"
import { useFormBinder } from "@corets/use-form-binder"

const Example = () => {
  const form = useForm(() => createForm({
    input: "text",
    checkbox: true,
    radio: "second",
    select: "second",
  }))
  const bind = useFormBinder(form)
  
  return (
    <form { ...bind.form() }>
      <input type="text" { ...bind.input("input") } />
      
      <input type="checkbox" { ...bind.checkbox("checkbox") } />
      
      <input type="radio" { ...bind.radio("radio", "first") } />
      <input type="radio" { ...bind.radio("radio", "second") } />
      
      <select { ...bind.select("select") }>
        <option value="first">Option 1</option>
        <option value="second">Option 2</option>
        <option value="third">Option 3</option>
      </select>
      
      <button { ...bind.submit() }>Submit</button>
    </form>
  )
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.corets.io/hooks/use-form-binder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
