How to use the @material/chips/chip-set/foundation function in @material/chips

To help you get started, we’ve selected a few @material/chips 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 pgbross / vue-material-adapter / packages / mcwv-chips / chip-set.js View on Github external
mounted() {
    // do not delete this reference as it triggers initial chip list instantiation.
    this.chips_;
    this.foundation = new MDCChipSetFoundation({
      focusChipPrimaryActionAtIndex: index => {
        const chip = this.chips_[index];

        chip && chip.focusPrimaryAction();
      },
      focusChipTrailingActionAtIndex: index => {
        const chip = this.chips_[index];
        chip && chip.focusTrailingAction();
      },
      getChipListCount: () => {
        return this.chips_.length;
      },
      getIndexOfChipById: chipId => {
        return this.chips_.findIndex(({ id }) => id == chipId);
      },
      hasClass: className => this.$el.classList.contains(className),