Skip to content

Checkbox

The Checkbox component captures a single boolean choice—ideal for opt-in consents or feature toggles.

PropertyTypeRequiredDescription
type"checkbox"YesIdentifies the field
labelstringYesText displayed next to the box
schemaz.ZodTypeYesShould validate to boolean

All common props like hidden, disabled, readOnly are supported.

Terms acceptance checkbox
basic-checkbox.tsx
import { z } from "zod";
import { createExampleForm } from "../createExampleForm";
export const BasicCheckbox = createExampleForm({
formId: "basic-checkbox",
fields: {
agree: {
type: "checkbox",
label: "I agree to the terms",
schema: z.boolean().refine((val) => val === true, {
message: "You must accept the terms",
}),
},
},
steps: {
step1: {
id: "step1",
fields: ["agree"],
},
},
});
  • Keyboard toggling with Space.
  • Appropriate aria-checked state and focus ring supplied by ShadCN.