How to use the @material/switch.MDCSwitchFoundation function in @material/switch

To help you get started, we’ve selected a few @material/switch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / components / src / material-experimental / mdc-slide-toggle / slide-toggle.ts View on Github external
ngAfterViewInit() {
    const foundation = this._foundation = new MDCSwitchFoundation(this._adapter);
    foundation.setDisabled(this.disabled);
    foundation.setChecked(this.checked);
  }
github trimox / angular-mdc-web / packages / switch / switch.ts View on Github external
getDefaultFoundation() {
    const adapter: MDCSwitchAdapter = {
      addClass: (className: string) => this._getHostElement().classList.add(className),
      removeClass: (className: string) => this._getHostElement().classList.remove(className),
      setNativeControlChecked: (checked: boolean) => this._getInputElement().checked = checked,
      setNativeControlDisabled: (disabled: boolean) => this._getInputElement().disabled = disabled
    };
    return new MDCSwitchFoundation(adapter);
  }
github jamesmfriedman / rmwc / src / switch / index.tsx View on Github external
getDefaultFoundation() {
    return new MDCSwitchFoundation({
      addClass: (className: string) => this.root.addClass(className),
      removeClass: (className: string) => this.root.removeClass(className),
      setNativeControlChecked: (checked: boolean) =>
        this.nativeControl.setProp('checked', checked),
      setNativeControlDisabled: (disabled: boolean) =>
        this.nativeControl.setProp('disabled', disabled)
    });
  }