Skip to content

Button Checkbox

The Button Checkbox field lets users pick multiple options using button-style toggles. Internally it stores an array of selected values.

PropertyTypeRequiredDescription
type"button-checkbox"YesIdentifies the field
optionsOption[]YesArray with label, value, optional icon
multipletrue (implicit)Always multi-select
Select target platforms
button-checkbox-example.tsx
import { Apple, Smartphone } from "lucide-react";
import { z } from "zod";
import { createExampleForm } from "../createExampleForm";
export const PlatformsButtonCheckbox = createExampleForm({
formId: "platforms-button-checkbox",
fields: {
platforms: {
type: "button-checkbox",
label: "Target Platforms",
options: [
{ label: "iOS", value: "ios", icon: <Apple /> },
{ label: "Android", value: "android", icon: <Smartphone /> },
],
schema: z.array(z.string()).min(1, "Select at least one platform"),
},
},
steps: {
step1: {
id: "step1",
fields: ["platforms"],
},
},
});

Use z.array(z.string()).min(1) to require at least one selection or add advanced rules.