Checkbox
Checkboxes allow users to select one or more items from a set. Checkboxes can turn an option on or off.
Figma Link
- Web Components
- Flutter
Demo
zeta-web v0.12.9
Web Components
Storybook
https://design.zebra.com/web/storybook/?path=/docs/components-checkbox--docs
Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| reverse | Whether the order of the checkbox and its label should be reversed. | boolean | false |
Inherited Attributes
| Name | Description | Type | Default | Inherited From |
|---|---|---|---|---|
| autoCapitalize | Whether inputted text is automatically capitalized and how. Only takes effect on non-keyboard entry | "none" | "off" | "sentences" | "on" | "words" | "characters" | undefined | undefined | BaseToggleFormElement |
| autoComplete | AutoFill | undefined | undefined | BaseToggleFormElement | |
| name | The name of the form control. | string | "" | BaseToggleFormElement |
| id | The id of the form control. | string | "" | BaseToggleFormElement |
| required | Indicates whether the form control is required to be filled out before submitting the form. | boolean | false | BaseToggleFormElement |
| value | The value of the Form Control that is submitted when part of a form. | string | null | null | BaseToggleFormElement |
| checked | The state of the Switch or Checkbox that is submitted when part of a form. | boolean | undefined | BaseToggleFormElement |
| indeterminate | The state of the Switch or Checkbox defined by a mixed or unknown state. | boolean | false | BaseToggleFormElement |
| placeholder | Placeholder text shown when value is empty. | string | undefined | undefined | BaseToggleFormElement |
| min | The minimum value for number inputs | number | undefined | undefined | BaseToggleFormElement |
| max | The maximum value for number inputs | number | undefined | undefined | BaseToggleFormElement |
| readOnly | Placeholder text shown when value is empty. | boolean | undefined | undefined | BaseToggleFormElement |
| spellCheck | Whether to spellcheck the input | boolean | "default" | undefined | undefined | BaseToggleFormElement |
| disabled | Boolean for if component is disabled.This will apply disabled styles. | boolean | false | BaseToggleFormElement |
| tabIndex | The tab index of the component, used to determine the order in which elements receive focus when the user navigates through the document by pressing the Tab key. | number | 0 | BaseToggleFormElement |
| rounded | Whether the component is rounded or sharp.When true, rounded will set the border radius of the first child, and any children with class 'contourable-target' to --radius-minimal.Otherwise, this value will be --radius-none. | boolean | undefined | true | BaseToggleFormElement |
CSS Properties
| Name | Description |
|---|---|
| --checkbox-background | Background colour of the checkbox in its default/unchecked state |
| --checkbox-checked-background | Background colour when the checkbox is checked or indeterminate |
| --checkbox-hover-background | Background colour when hovering over a checked/indeterminate checkbox |
| --checkbox-border-color | Border colour of the checkbox container |
| --checkbox-icon-color | Colour of the checkmark or indeterminate icon inside the checkbox |
Demo
Widgetbook
Inheritance
Object > DiagnosticableTree > Widget > StatefulWidget > FormField<bool>
Constructors
Constructs a ZetaCheckbox.
ZetaCheckbox.new({bool value = false, String? label, ValueChanged<bool>? onChanged, bool? rounded, bool useIndeterminate = false, FocusNode? focusNode, String? semanticLabel, FormFieldValidator<bool>? validator, AutovalidateMode? autovalidateMode, String? restorationId, Key? key})
Properties
| Name | Description | Type | Features |
|---|---|---|---|
| autovalidateMode | Used to enable/disable this form field auto validation and update its | AutovalidateMode | final inherited |
| builder | Function that returns the widget representing this form field. | FormFieldBuilder<bool> | final inherited |
| enabled | Whether the form is able to receive user input. | bool | final inherited |
| errorBuilder | Function that returns the widget representing the error to display. | FormFieldErrorBuilder? | final inherited |
| focusNode | An optional focus node to use as the focus node for this widget. | FocusNode? | final |
| forceErrorText | An optional property that forces the FormFieldState into an error state | String? | final inherited |
| hashCode | The hash code for this object. | int | no setter inherited |
| initialValue | An optional value to initialize the form field to, or null otherwise. | bool? | final inherited |
| key | Controls how one widget replaces another widget in the tree. | Key? | final inherited |
| label | The label displayed next to the checkbox | String? | final |
| onChanged | Called when the value of the checkbox should change. | ValueChanged<bool>? | final |
| onReset | An optional method to call when the form field is reset via | VoidCallback? | final inherited |
| onSaved | An optional method to call with the final value when the form is saved via | FormFieldSetter<bool>? | final inherited |
| restorationId | Restoration ID to save and restore the state of the form field. | String? | final inherited |
| rounded | Sets rounded or sharp border of the containing box and the icon style. | bool? | final |
| runtimeType | A representation of the runtime type of the object. | Type | no setter inherited |
| semanticLabel | Value passed into wrapping Semantics widget. | String? | final |
| useIndeterminate | Whether the indeterminate state should be supported. | bool | final |
| validator | An optional method that validates an input. Returns an error string to | FormFieldValidator<bool>? | final inherited |
| value | Whether the checkbox is selected, unselected or null (indeterminate) | bool | final |