Comparison guide
Bollard UI vs React Hook Form: A Complementary Pair
React Hook Form coordinates form state and submission. Bollard UI contributes fields and safety interactions. Use each for the part of the form it already handles well.
By Tushar Khadde · Published · Updated
| Concern | Bollard UI | Complementary tool |
|---|---|---|
| Main job | Copy-paste React fields, warnings and review interactions. | Form registration, state, validation timing and submission workflow. |
| Owns field state? | Supports controlled inputs and standalone interactions. | Can manage registered and controlled values across a form. |
| Use together | Render a guardrail as the field control or next to a registered field. | Connect it with register or Controller and keep submission handling. |
A form library is not the same thing as an input design
React Hook Form helps manage values, validation state and submission with a small rendering footprint. It is a form workflow tool. Bollard UI supplies copy-paste React components such as email and amount inputs, plus readbacks and confirmations for mistakes that ordinary field validation may not detect. It does not require replacing React Hook Form or taking over your form’s submit handler.
Use React Hook Form to register values, coordinate errors and handle submit. Render a Bollard component as the visible field, then connect its controlled value to the form using the API that matches the component. If a component uses specialized value callbacks, Controller is a natural adapter.
Amount field with Controller
import { Controller, useForm } from "react-hook-form"
import { AmountInput } from "@/components/ui/amount-input"
function TransferForm() {
const { control, handleSubmit } = useForm({ defaultValues: { amountPaise: 0 } })
return (
<form onSubmit={handleSubmit(saveTransfer)}>
<Controller
name="amountPaise"
control={control}
rules={{ min: { value: 1, message: "Enter an amount." } }}
render={({ field, fieldState }) => (
<AmountInput label="Transfer amount" currency="INR" locale="en-IN"
value={field.value} onValueChange={field.onChange}
onBlur={field.onBlur} aria-invalid={fieldState.invalid} />
)}
/>
<button type="submit">Continue</button>
</form>
)
}Decide which layer owns each rule
Use React Hook Form rules or your schema resolver for form-level requirements such as required fields, numeric bounds and cross-field dependencies. Use a guardrail when the issue depends on context or user intent: a likely domain typo, a surprising amount, a stale value or a dangerous action. Keep messages consistent and ensure a server enforces every rule that protects data or permissions.
For a controlled Bollard field, pass the current value and update callback through Controller. For a native input, React Hook Form’s register may be sufficient. Do not attach two independent state owners to one field; choose one source of truth and make validation errors appear in the right field and summary.
Submit still validates at the server
const onSubmit = handleSubmit(async (values) => {
const response = await fetch("/api/transfers", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(values),
})
if (!response.ok) setError("root.server", { message: "Transfer could not be created." })
})Frequently asked questions
Do I need to migrate away from React Hook Form?
No. Bollard components can be used as controls in an existing form. Keep your current registration and submit flow.
Can I use a Bollard component with Controller?
Yes. Controller adapts controlled components and custom value callbacks to React Hook Form’s state.
Does the UI validate the submitted request?
Client feedback helps users, but the server must validate submitted data and enforce authorization.