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
, , , , , ,
Name | Type | Default | Description |
---|---|---|---|
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? | false | Whether the checkbox is disabled. If true, the checkbox cannot be interacted with and is not submitted in a form. | |
required? | false | Whether the checkbox is required or not. |
CheckboxControlledProps
Name | Type | Default | Description |
---|---|---|---|
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
Name | Type | Default | Description |
---|---|---|---|
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. |