Radio and checkbox groups
Choose one string value or multiple string values.
Radio: one value
Use a string enum or string field with options, then set type: "radio". The result is one string. String enums infer options automatically; supply label/value objects for readable labels.
Checkbox group: multiple values
Use an array of strings, set inputType: "checkbox-group" on the array field configuration, and supply options. The value is an array such as ["email", "sms"], not a boolean. inputType belongs directly on the field, outside the array options object.
Usage
Use your form instance from useForm. See the initial setup.
const schema = z.object({
plan: z.enum(["free", "pro"]),
channels: z.array(z.string()),
});
<ErlForm
form={form}
schema={schema}
fieldConfig={{
plan: { type: "radio" },
channels: {
inputType: "checkbox-group",
options: [
{ label: "Email", value: "email" },
{ label: "SMS", value: "sms" },
],
},
}}
/>In 1.0.0, the separate checkbox-group renderer does not apply all disabled/readonly/required state or the single-field error display. Keep validation in the schema and use a custom array container when necessary. The built-in radio change handler does not enforce readonly either.