A checkbox input component.

Parameters:
NameTypeDescription
propsobject

Component props.

Properties
NameTypeDescription
customAttributesobject

Custom attributes for the component.

customClassesstring | Array | object

Custom classes for the component.

disabledboolean

If checkbox is disabled.

externalCheckedboolean

If checkbox is checked or not, can change current checked state if changed.

externalControlboolean

If checkbox is controlled externally.

helpTextAttributesobject

Custom attribute for the help text.

idstring

Optional id. Auto generated if not passed.

indeterminateboolean

If checkbox is indeterminate, only works if externally controlled.

initialCheckedboolean

Whether it is checked on initial render.

labelAttributesobject

Custom attributes for the label.

namestring

The name attribute for the checkbox.

onBlurfunction

On blur function handler.

onChangefunction

On change function handler.

onFocusfunction

On focus function handler.

sizestring

The checkbox size, small (size-sm) or medium (size-md).

spacingstring | number | Array | object

The spacing for the component, as a string, number, array, or object.

themestring

The theme of the checkbox.

valuestring

The checkbox value.

wrapperAttributesobject

Custom attributes for the wrapper element.

wrapperClassesstring | Array | object

Custom classes for the wrapper element.

wrapperTagNamestring

Tag to use for the checkbox wrapper. Defaults to div.

refobject | null

Ref to the component.

Since
  • 1.1.15
Returns:

The checkbox component.

Type: 
JSX.Element
Example
import Checkbox from '@gravityforms/components/react/admin/elements/Checkbox';

return (
    <Checkbox />
        checked={ true }
        labelAttributes={ {
            label: 'Check me!',
        } }
        id="checkbox"
        onChange={ () => {} }
    />
);