react-mdc-web icon indicating copy to clipboard operation
react-mdc-web copied to clipboard

Implement Tab Component

Open manojktechie opened this issue 7 years ago • 4 comments

https://github.com/material-components/material-components-web/tree/feat/mdc-tabs/packages/mdc-tabs

manojktechie avatar Apr 15 '17 19:04 manojktechie

thanks, @manoj150283

kradio3 avatar Apr 15 '17 20:04 kradio3

@manoj150283 do you have an example for tab component with Toolbar?

gasolin avatar Jun 14 '17 15:06 gasolin

Hi @gasolin , This example works for me:

        <Toolbar 
          fixed
          z={4} 
        >
          <ToolbarSection>
            <Tabbar>
              <Tab 
                active={this.state.activeTab===1}
                onClick={() => {this.setState({activeTab:1})}}
              >
                Item One
              </Tab>
              <Tab 
                active={this.state.activeTab===2}
                onClick={() => {this.setState({activeTab:2})}}
              >
                Item Two
              </Tab>
              <Tab 
                active={this.state.activeTab===3}
                onClick={() => {this.setState({activeTab:3})}}
              >
                Item Three
              </Tab>
            </Tabbar>
          </ToolbarSection>
        </Toolbar>

kradio3 avatar Jun 15 '17 12:06 kradio3

@kradio3 thanks it works, though if I wrap the tab text content with <a> or Link from react-router-dom, the Tab will looks like a url but not the tab anymore. Not sure if its intended.

The workaround now is adding extra style in each link to inherit the style.

const linkStyle = {
  color: "inherit",
  textDecoration: "inherit",
}

<Tab>
<Link style={linkStyle}></Link>
</Tab>

gasolin avatar Jun 17 '17 09:06 gasolin