React Tab Bar
A React version of an MDC Tab Bar.
Installation
npm install @material/react-tab-bar
Usage
Styles
with Sass:
import '@material/react-tab-bar/index.scss';import '@material/react-tab-scroller/index.scss';
with CSS:
@///@///
Javascript Instantiation
;;; Component state = activeIndex: 0; { return <div> <TabBar activeIndex=thisstateactiveIndex handleActiveIndexUpdate= this > <Tab> <span className='mdc-tab__text-label'>One</span> </Tab> ... </TabBar> </div> ; }
NOTE: You can also use a custom tab component with the
TabBar
, but it must implement the methodsactivate
,deactivate
,focus
,computeIndicatorClientRect
, andcomputeDimensions
. SeeMDCTab
documentation for more details.
Props
Prop Name | Type | Description |
---|---|---|
activeIndex | number | Index of the active tab. |
indexInView | number | Index of the tab to be scrolled into view. |
handleActiveIndexUpdate | Function(activeIndex: number) => void | Callback after the active index is updated. |
className | string | Classes to appear on className attribute of root element. |
isRtl | Boolean | Whether the direction of the tab bar is RTL. |
Sass Mixins
Sass mixins may be available to customize various aspects of the components. Please refer to the MDC Web repository for more information on what mixins are available, and how to use them.