MaterialToggleComponent class
material-toggle
is a button that can be either ON or OFF.
User can tap the toggle button to change the state.
Usually you use toggle buttons when you have a single ON/OFF option.
If you have multiple options from a set to be checked/unchecked, use
material-checkbox
instead.
- Implemented types
- Annotations
-
- @Component(selector: 'material-toggle', styleUrls: ['material_toggle.scss.css'], templateUrl: 'material_toggle.html', directives: [NgIf], providers: [ExistingProvider(HasDisabled, MaterialToggleComponent)], changeDetection: ChangeDetectionStrategy.onPush)
Constructors
- MaterialToggleComponent(ChangeDetectorRef _changeDetector, @Self() @Optional() NgControl? cd)
Properties
- ariaLabel ↔ String?
-
ARIA label to use for the toggle button.
getter/setter pair
- checked ↔ bool
-
Current state of the toggle button.
getter/setter pair
- disabled ↔ bool
-
Enables/disables the toggle button.
getter/setter pairoverride
- hasFocus ↔ bool
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasLabel → bool
-
no setter
- isHovered ↔ bool
-
getter/setter pair
- label ↔ String?
-
Label for the toggle button.
getter/setter pair
-
onChecked
→ Stream<
bool> -
Event that is fired when the toggle is checked.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shadow_z ↔ int
-
Sets the depth of the shadow
getter/setter pair
- toggleElement ↔ HtmlElement?
-
getter/setter pair
Methods
-
createRipple(
) → void -
handleClick(
MouseEvent mouseEvent) → void -
handleKeyPress(
KeyboardEvent keyEvent) → void -
ngAfterViewInit(
) → void -
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 -
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