Skip to content
github

Form Input

FormInput is a set of thin wrappers that bind the input primitives to React Hook Form. Each wrapper reads the surrounding form context, so you pass a name (the field path) plus the underlying input’s props — value, onChange, and validation wiring are handled for you.

Use these instead of the raw inputs whenever a field lives inside a form, so state, errors, and submission stay consistent.

Because these require a form context to function, they’re documented here with usage code rather than a standalone live preview. For a full, runnable form see the Form page.

Available inputs

FormInput.Text, FormInput.Textarea, FormInput.Number, FormInput.Time, FormInput.Radio, FormInput.Checkbox, FormInput.Select, FormInput.MultiSelect — each maps to its corresponding primitive (TextInput, Textarea, NumberInput, TimeInput, Radio, Checkbox, Select, MultiSelect).

Installation

import { FormProvider, useForm } from "react-hook-form";
import { FormInput, Button } from "@harnessio/ui/components";
function ConnectorForm() {
const methods = useForm({
defaultValues: { name: "", type: "", enabled: false },
});
return (
<FormProvider {...methods}>
<form onSubmit={methods.handleSubmit(console.log)}>
<FormInput.Text name="name" label="Name" placeholder="my-connector" />
<FormInput.Select
name="type"
label="Type"
options={[
{ label: "GitHub", value: "github" },
{ label: "GitLab", value: "gitlab" },
]}
/>
<FormInput.Checkbox name="enabled" label="Enabled" />
<Button type="submit">Save</Button>
</form>
</FormProvider>
);
}

Each wrapper forwards the full prop set of its underlying primitive — see the individual input pages (Text Input, Select, Checkbox, etc.) for the available props.