How to use the @material/icon-toggle/dist/mdc.iconToggle.MDCIconToggleFoundation function in @material/icon-toggle

To help you get started, we’ve selected a few @material/icon-toggle 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 gutenye / react-mc / src / IconToggle / IconToggle.js View on Github external
getDefaultFoundation() {
    const { iconInnerSelector: sel } = this.root_.dataset
    this.iconEl_ = sel ? this.root_.querySelector(sel) : this.root_
    // prettier-ignore
    return new MDCIconToggleFoundation({
      addClass: (className) => this.iconEl_.classList.add(className),
      removeClass: (className) => this.iconEl_.classList.remove(className),
      registerInteractionHandler: helper.registerHandler('rootProps', this),
      deregisterInteractionHandler: helper.deregisterHandler('rootProps', this),
      setText: (text) => { this.iconEl_.textContent = text },
      getTabIndex: helper.getAttr('rootProps', this, 'tabIndex'),
      setTabIndex: helper.setAttr('rootProps', this, 'tabIndex'),
      getAttr: helper.getAttr('rootProps', this),
      setAttr: helper.setAttr('rootProps', this),
      rmAttr: helper.rmAttr('rootProps', this),
      notifyChange: (detail) => {
        this.props.onChange_({ detail })
        this.props.onChange({ target: { checked: detail.isOn } })
      }
    })
  }