MaterialCheckboxComponent class

material-checkbox is a button that can be either checked or unchecked.

User can tap the checkbox to check or uncheck it. Usually you use checkboxes to allow user to select multiple options from a set. If you have a single ON/OFF option, avoid using a single checkbox and use material-toggle instead.

We are not extending ButtonDecorator because we need to override several attributes, including role, tabindex, but most importantly because checkbox should only be interactible with SPACE, while button is for both SPACE and ENTER.

Attributes:

  • no-ink -- set this attribute to disable the ripple effect on the chip.
Implemented types
Annotations
  • @Component(selector: 'material-checkbox', providers: [ExistingProvider(HasDisabled, MaterialCheckboxComponent)], directives: [MaterialIconComponent, MaterialRippleComponent, NgIf], templateUrl: 'material_checkbox.html', styleUrls: ['material_checkbox.scss.css'], changeDetection: ChangeDetectionStrategy.onPush)

Constructors

MaterialCheckboxComponent(HtmlElement _root, ChangeDetectorRef _changeDetector, @Self() @Optional() NgControl? cd, @Attribute('tabindex') String? hostTabIndex, @Attribute('role') String? role)

Properties

checked bool
Whether button is checked.
getter/setter pair
checkedStr String
ARIA-checked state, like icon, has 3 states.
no setter
contentId String
Id for the checkbox label and content.
final
disabled bool
getter/setter pairoverride
disabledStr String
Whether the checkbox should not respond to events, and have a style that suggests that interaction is not allowed.
no setter
focusDelegate Future?
Unimplemented for M1.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
icon Icon
Current icon, depends on the state of checked and indeterminate.
no setter
indeterminate bool
Alternative state of the checkbox, not user set-able state. Between checked and indeterminate, only one can be true, though both can be false.
getter/setter pair
indeterminateToChecked bool
Determines the state to go into when indeterminate state is toggled.
getter/setter pair
label String?
Label for the checkbox, alternatively use content.
getter/setter pair
onChange Stream<String>
Fired when checkbox state changes, sends checkedStr, i.e. ARIA state.
no setter
onChecked Stream<bool>
Fired when checkbox is checked or unchecked, but not when set indeterminate. Sends the state of checked.
no setter
onIndeterminate Stream<bool>
Fired when checkbox goes in and out of indeterminate state, but not when set to checked.
no setter
readOnly bool?
Whether the checkbox can be changed by user interaction.
getter/setter pair
rippleColor String?
Color of the ripple.
no setter
role String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showFocus bool
Whether focus should be drawn.
no setter
tabIndex String
no setter
themeColor String?
Color of the checkbox and ripple when checked.
getter/setter pair

Methods

focus() → void
Item/component focuses itself
override
handleBlur(Event event) → void
handleClick(MouseEvent mouseEvent) → void
handleFocus(dynamic _) → void
handleKeyPress(KeyboardEvent event) → void
handleKeyUp(KeyboardEvent event) → void
handleMouseDown(MouseEvent mouseEvent) → void
ngOnDestroy() → void
Executed before the directive is removed from the DOM and destroyed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDisabledChanged(bool isDisabled) → void
This function is called when the control status changes to or from "DISABLED".
registerOnChange(ChangeFunction<bool> callback) → void
Set the function to be called when the control receives a change event.
registerOnTouched(TouchFunction callback) → void
Set the function to be called when the control is touched.
toggleChecked() → void
Toggles checkbox via user action.
toString() String
A string representation of this object.
inherited
writeValue(bool isChecked) → void
Write a new value to the element.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

hostClass → const String