Skip to main content

Checkbox

Checkboxes allow the user to select one or more options from a list of options.

CheckboxProps

Signature:

export declare type CheckboxProps = < | , (checked: , event?: <>) => | > & & & & & & { /** * A representing the value used for the checkbox. * When submitted in a form, it is only submitted if checked, with the set value. * If , the is submitted by default as per https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#attr-value. */ formValue?: ; };

CheckboxBaseProps

extends, , , , , ,
NameTypeDefaultDescription
formValue?
-A string representing the value used for the checkbox. When submitted in a form, it is only submitted if checked, with the set value. If undefined, the string 'on' is submitted by default as per https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#attr-value.
disabled?
falseWhether the checkbox is disabled. If true, the checkbox cannot be interacted with and is not submitted in a form.
required?
falseWhether the checkbox is required or not.

CheckboxControlledProps

NameTypeDefaultDescription
value
|
-Whether the checkbox is checked or not. If present, it indicates that the checkbox is checked by default (when the page loads). If false, the checkbox is not submitted in a form.
name?
-The name used for the checkbox. This is submitted along with the value when the form data is submitted. If the name is undefined or empty, the input's value is not submitted with the form.
onChange
(checked: , event?: <>) =>
-Handler that is called when the checked attribute changes.

CheckboxUncontrolledProps

NameTypeDefaultDescription
defaultValue?
|
-Whether the (uncontrolled) checkbox is checked by default or not.
name
-The name used for the checkbox. This is submitted along with the value when the form data is submitted. If the name is undefined or empty, the input's value is not submitted with the form.
Still have questions?
Find answers in the Dynatrace Community