FormComponentsCheckbox Field

Checkbox Field

CheckboxField is a specialized reusable input component for Shaddy Form.

CheckboxField is a specialized reusable input component for Shaddy Form. It is designed for single checkbox use cases and supports labels, required state, disabled state, flexible layout options, and more.

Installation

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

Props

NameTypeDefaultDescription
namestring (from react-hook-form Path)requiredThe field name (must match your form schema).
labelstringThe label displayed next to the checkbox.
requiredbooleanfalseMarks the field as required.
disabledbooleanfalseDisables the checkbox when true.
columnbooleanfalseArranges the checkbox and label in a column.
longGapbooleanfalseAdds extra space between the checkbox and label.
reversebooleanfalseReverses the order of the checkbox and label.
gap'2' | '4' | '6' | '8''2'Sets the gap between the checkbox and label.
classNamestringAdditional CSS classes for the field container.

Usage

<ShaddyForm>
  <CheckboxField name="isActive" label="Is Active" required gap="4" />
</ShaddyForm>

Notes

  • CheckboxField is intended for single checkbox use (not for checkbox groups).
  • You can control the layout and spacing using the column, longGap, reverse, and gap props.