FormComponentsCheckbox Group Field

Checkbox Group Field

CheckboxGroupField is a specialized reusable input component for Shaddy Form.

CheckboxGroupField is a specialized reusable input component for Shaddy Form. It is used for multiple checkbox selections and supports labels, required state, flexible layout, and more.

Installation

pnpm dlx shadcn@latest add https://shaddy-docs.vercel.app/r/checkbox-group-field

Props

NameTypeDefaultDescription
namestring (from react-hook-form Path)requiredThe field name (must match your form schema).
labelstringThe label displayed above the group.
options{ text: string; value: string }[]requiredArray of options for the checkbox group.
classNamestringAdditional CSS classes for the field container.
disabledbooleanDisables all checkboxes when true.
columnbooleantrueArranges checkboxes in a column (or row if false).
requiredbooleanMarks the field as required.

Usage

const skillOptions = [
  { text: "React", value: "react" },
  { text: "Vue", value: "vue" },
  { text: "Angular", value: "angular" },
]
 
<ShaddyForm>
  <CheckboxGroupField
    name="skills"
    label="Skills"
    options={skillOptions}
    required
  />
</ShaddyForm>
 

Notes

  • CheckboxGroupField is intended for multiple checkbox selection (array of values).
  • Use the column prop to control vertical or horizontal layout.