Skip to content

CheckboxField

A checkbox input for boolean values. An undefined value displays as unchecked; clicking writes the control’s boolean checked state.

PropTypeDefaultDescription
value(instance: TCommand) => unknownRequired. Accessor function returning the property value from the command instance.
titlestringThe label for the field (shown when showTitles is enabled).
labelstringLabel text displayed next to the checkbox.
requiredbooleanOverride automatic required detection.

A required flag does not require this command property to be true: false is a present boolean and CommandForm uses noValidate. A consent checkbox needs an explicit backend rule requiring true. The built-in adjacent label is not linked with an input ID; use a custom field for explicit accessible label association. See Common props for styling and population.

These illustrative field fragments require imports for CheckboxField from @cratis/arc.react/commands and your generated UserCommand with boolean agreeToTerms and newsletter properties. Place them inside that command’s form, initialized with intentional boolean defaults.

<CheckboxField<UserCommand>
value={c => c.agreeToTerms}
title="Terms of Service"
label="I agree to the terms and conditions"
/>
<CheckboxField<UserCommand>
value={c => c.newsletter}
title="Newsletter"
label="Send me newsletter updates"
/>