How to use @material/floating-label - 10 common examples

To help you get started, we’ve selected a few @material/floating-label 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 matsp / material-components-vue / components / floating-label / FloatingLabel.vue View on Github external
mounted () {
    if (!(this.getLabel instanceof Function)) { // can not be init by parent
      this.mdcFloatingLabel = MDCFloatingLabel.attachTo(this.$el)
    }
  },
  beforeDestroy () {
github src-zone / material / bundle / src / components / floating-label / mdc.floating-label.directive.ts View on Github external
},
        getWidth:() => this._elm.nativeElement.offsetWidth,
        registerInteractionHandler: (type: string, handler: EventListener) => {
            this.registry.listen(this._rndr, type, handler, this._elm);
        },
        deregisterInteractionHandler: (type: string, handler: EventListener) => {
            this.registry.unlisten(type, handler);
        }
    };
    _foundation: {
        init: Function,
        destroy: Function,
        float: (should: boolean) => void,
        shake: (should: boolean) => void,
        getWidth: () => number
    } = new MDCFloatingLabelFoundation(this._mdcAdapter);

    constructor(private _rndr: Renderer2, public _elm: ElementRef, private registry: MdcEventRegistry) {
        super();
    }

    ngAfterContentInit() {
        this._foundation.init();
        this._initialized = true;
    }

    ngOnDestroy() {
        this._foundation.init();
        this._initialized = false;
    }
}
github pgbross / vue-material-adapter / packages / mcwv-floating-label / floating-label.js View on Github external
mounted() {
    this.foundation = new MDCFloatingLabelFoundation({
      addClass: className => {
        this.$set(this.labelClasses, className, true);
      },
      removeClass: className => {
        this.$delete(this.labelClasses, className);
      },
      getWidth: () => this.$el.scrollWidth,
      registerInteractionHandler: (evtType, handler) => {
        this.$el.addEventListener(evtType, handler);
      },
      deregisterInteractionHandler: (evtType, handler) => {
        this.$el.removeEventListener(evtType, handler);
      },
    });
    this.foundation.init();
  },
github pgbross / vue-material-adapter / packages / mcwv-floating-label / mdc-floating-label.js View on Github external
mounted() {
    this.foundation = new MDCFloatingLabelFoundation({
      addClass: className => {
        this.$set(this.labelClasses, className, true);
      },
      removeClass: className => {
        this.$delete(this.labelClasses, className);
      },
      getWidth: () => this.$el.scrollWidth,
      registerInteractionHandler: (evtType, handler) => {
        this.$el.addEventListener(evtType, handler);
      },
      deregisterInteractionHandler: (evtType, handler) => {
        this.$el.removeEventListener(evtType, handler);
      },
    });
    this.foundation.init();
  },
github material-components / material-components-web-react / packages / floating-label / index.tsx View on Github external
initializeFoundation = () => {
    this.foundation = new MDCFloatingLabelFoundation(this.adapter);
    this.foundation.init();
  };
github material-components / material-components-web-components / packages / floating-label / src / mwc-floating-label-directive.ts View on Github external
export const floatingLabel = directive(() => (part: PropertyPart) => {
  const lastFoundation = partToFoundationMap.get(part);
  if (!lastFoundation) {
    const labelElement = part.committer.element as FloatingLabel;
    labelElement.classList.add('mdc-floating-label');
    const adapter = createAdapter(labelElement);
    const foundation = new MDCFloatingLabelFoundation(adapter);
    foundation.init();
    part.setValue(foundation);
    partToFoundationMap.set(part, foundation);
  }
});
github material-components / material-components-web / packages / mdc-textfield / component.ts View on Github external
      labelFactory: MDCFloatingLabelFactory = (el) => new MDCFloatingLabel(el),
      outlineFactory: MDCNotchedOutlineFactory = (el) => new MDCNotchedOutline(el),
github material-components / material-components-web / packages / mdc-select / component.ts View on Github external
      labelFactory: MDCFloatingLabelFactory = (el) => new MDCFloatingLabel(el),
      lineRippleFactory: MDCLineRippleFactory = (el) => new MDCLineRipple(el),
github SpringflowNL / aurelia-mdc-elements / node_modules / @material / select / component.js View on Github external
        if (labelFactory === void 0) { labelFactory = function (el) { return new MDCFloatingLabel(el); }; }
        if (lineRippleFactory === void 0) { lineRippleFactory = function (el) { return new MDCLineRipple(el); }; }
github SpringflowNL / aurelia-mdc-elements / node_modules / @material / textfield / component.js View on Github external
        if (labelFactory === void 0) { labelFactory = function (el) { return new MDCFloatingLabel(el); }; }
        if (outlineFactory === void 0) { outlineFactory = function (el) { return new MDCNotchedOutline(el); }; }