How to use the @material/tab-bar.MDCTabBarFoundation function in @material/tab-bar

To help you get started, we’ve selected a few @material/tab-bar 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 trimox / angular-mdc-web / packages / tab-bar / tab-bar.ts View on Github external
if (!this._indexIsInRange(previousActiveIndex)) {
          previousActiveIndex = this.activeTabIndex;
        }
        return this.tabs.toArray()[previousActiveIndex].computeIndicatorClientRect();
      },
      getTabDimensionsAtIndex: (index: number) => this.tabs.toArray()[index].computeDimensions(),
      getPreviousActiveTabIndex: () => this.tabs.toArray().findIndex((_) => _.active),
      getFocusedTabIndex: () =>
        this._platform.isBrowser ? this.tabs.toArray().findIndex(tab =>
          tab.elementRef.nativeElement === document.activeElement!) : -1,
      getIndexOfTabById: (id: string) => this.tabs.toArray().findIndex(tab => id === tab.id),
      getTabListLength: () => this.tabs.length,
      notifyTabActivated: (index: number) =>
        this.activated.emit({ source: this, index: index, tab: this.tabs.toArray()[index] })
    };
    return new MDCTabBarFoundation(adapter);
  }
github jamesmfriedman / rmwc / src / tabs / tab-bar.tsx View on Github external
getDefaultFoundation() {
    return new MDCTabBarFoundation(
      /** @type {!MDCTabBarAdapter} */ {
        scrollTo: (scrollX: number) => {
          this.tabScroller && this.tabScroller.scrollTo(scrollX);
        },

        incrementScroll: (scrollXIncrement: number) =>
          this.tabScroller &&
          this.tabScroller.incrementScroll(scrollXIncrement),
        getScrollPosition: () =>
          this.tabScroller ? this.tabScroller.getScrollPosition() : 0,
        getScrollContentWidth: () =>
          this.tabScroller ? this.tabScroller.getScrollContentWidth() : 0,
        getOffsetWidth: () => (this.root.ref ? this.root.ref.offsetWidth : 0),
        isRTL: () =>
          !!this.root.ref &&
          window