Comparison guide

Bollard UI vs Zod: Complementary Validation

Zod validates data against schemas. Bollard UI adds React field experiences that help people catch common mistakes. Most form flows benefit from both.

By Tushar Khadde · Published · Updated

When Bollard UI and the compared tool are useful
ConcernBollard UIComplementary tool
Main jobVisible input guardrails and review patterns in React.Schema definition, parsing and validation of application data.
Where it runsCopied React components and a headless field hook.JavaScript/TypeScript runtime; usable on client and server.
Best boundaryHelp a person notice a typo, extra zero or risky action.Decide whether submitted data matches your domain schema.

A schema and a useful field experience solve different problems

Zod gives a team a way to describe data shapes, parse unknown input and produce structured validation results. It is useful at API boundaries, form submission and places where a value must satisfy a domain rule. Bollard UI supplies copy-paste React controls and guardrails that help a person catch mistakes while entering or reviewing data. A Zod schema does not by itself explain a likely email typo, show an extra-zero readback, or make a destructive target clear.

The libraries fit together: use a schema to establish what the application accepts, and add a field experience that helps someone reach a valid, intended value. A browser-side result remains a convenience. Validate again on the server before storing data or carrying out an action.

Zod plus a Bollard input

import { z } from "zod"
import { AmountInput } from "@/components/ui/amount-input"

const paymentSchema = z.object({
  amountPaise: z.number().int().positive().max(2_000_000),
})

function PaymentAmount({ value, onChange }) {
  return <AmountInput currency="INR" locale="en-IN" value={value} onValueChange={onChange} />
}

// Parse again at the trusted API boundary.
const payment = paymentSchema.parse(await request.json())

Keep user-intent checks separate from data validity

Some guardrails detect a plausible mistake rather than a value that is formally invalid. A transfer amount can be a valid positive integer and still be ten times larger than the person intended. An email string can pass a schema and still contain gmial.com. A typed confirmation phrase does not change the shape of a request; it makes the destructive target harder to approve by accident.

Represent actual business rules in your schema and server. Use the UI to explain what the person is about to send, preserve a clear correction path and make the next step explicit. Avoid making the client’s warning the only protection for money movement, access changes or deletion.

Validate after the field interaction

async function submitPayment(raw: unknown) {
  const parsed = paymentSchema.safeParse(raw)
  if (!parsed.success) return { ok: false, issues: parsed.error.issues }

  // Authenticate, authorize, check balance and apply idempotency here.
  return createPayment(parsed.data)
}

Frequently asked questions

Does Bollard UI replace Zod?

No. Zod handles schemas and parsing; Bollard provides React controls and user-facing guardrails. They are complementary.

Can a Zod schema validate on the server?

Yes. Parse untrusted request data at the server boundary and enforce authorization and business rules there.

Should I show every schema error while typing?

Choose timing based on the field. Keep feedback specific and avoid overwhelming people before they have finished entering a value.