Checkbox
The Checkbox component captures a single boolean choice—ideal for opt-in consents or feature toggles.
Properties
Section titled “Properties”| Property | Type | Required | Description |
|---|---|---|---|
type | "checkbox" | Yes | Identifies the field |
label | string | Yes | Text displayed next to the box |
schema | z.ZodType | Yes | Should validate to boolean |
All common props like hidden, disabled, readOnly are supported.
Example
Section titled “Example”Terms acceptance checkbox
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"], }, },});Accessibility
Section titled “Accessibility”- Keyboard toggling with Space.
- Appropriate
aria-checkedstate and focus ring supplied by ShadCN.