Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appbar with tabs #1445

Closed
thomasdelaet opened this issue Aug 18, 2015 · 8 comments
Closed

appbar with tabs #1445

thomasdelaet opened this issue Aug 18, 2015 · 8 comments
Labels
component: app bar This is the name of the generic UI component, not the React module! component: tabs This is the name of the generic UI component, not the React module!

Comments

@thomasdelaet
Copy link

Thanks for this amazing framework!

I'm trying to create an appbar with integrated tabs. Something like this: http://material-design.storage.googleapis.com/publish/material_v_4/material_ext_publish/0B6Okdz75tqQsOUdyb0FjQTJTdlk/components_tabs_usage_mobile3.png

Anyone has an idea on how to best achieve this?

Thanks!

@oliviertassinari
Copy link
Member

Yes you can with somethings like

var styles = {
  appBar: {
    flexWrap: 'wrap',
  },
  tabs: {
    width: '100%',
  },
};

       <AppBar title={xxxx} style={styles.appBar}>
          <Tabs onChange={this.onChangeTabs} style={styles.tabs}>
            <Tab label={xxxx} />
            <Tab label={xxxx} />
            <Tab label={xxxx} />
          </Tabs>
        </AppBar>

@thomasdelaet
Copy link
Author

Thanks Olivier

I did have to use some extra styling for padding but it worked.

Thanks.

@oliviertassinari
Copy link
Member

This is a hack waiting #773 to be addressed.

@shilch
Copy link

shilch commented Sep 24, 2016

Hi, thank you for this framework and the hack above!
Sadly there is one problem I am facing:
When using Tabs with the AppBar, there should not be this menu icon. So I disable it using showMenuIconButton={false} .
This makes the title disappear:

photo

Without the styles from the hack it looks like this:

photo2

Do you have any ideas?
Thank you in advance!

@oliviertassinari
Copy link
Member

@shilch That looks like an issue with the flexboxes. Try playing with the flex styles.

@tarifrudrapur
Copy link

tarifrudrapur commented Nov 12, 2016

Guys put your tabs inside a title of AppBar try this
<AppBar title={ <Tabs onChange={this.onChangeTabs} style={styles.tabs}> <Tab label={xxxx} /> <Tab label={xxxx} /> <Tab label={xxxx} /> </Tabs> } />

@ego
Copy link

ego commented Jul 2, 2017

Try like this

const styles = {
    paddingLeft: "20px"
};

const HeaderMenu = () => (
    <div>
      <span style={styles}>Blog</span>
      <span style={styles}>Event</span>
      <span style={styles}>Technology</span>
    </div>
);

<AppBar title={<HeaderMenu/>} />

@snsheth55
Copy link

Hello,

I am having difficulty getting the Appbar to wrap around with tabs, when the all of the tabs do not fit onto one line, this works automatically with strings but for tabs I'm not sure what to do.

This is my current set up using tabs inside the app bar

        <AppBar
          component="div"
          className={classes.secondaryBar}
          color="primary"
          position="sticky"
          elevation={10}
        >
          <Tabs value={getValue()} textColor="inherit" >
            <Tab key={'overview'} label="Overview" href={`/EditContracts/${tab}`}/>
              {arr}
            <AddTab value={props.numberOfSections + 1} addSection={tab2==='addSection'}/>
          </Tabs>
          {props.loading ? <LinearProgress color="secondary" /> : null}
        </AppBar>

@zannager zannager added component: app bar This is the name of the generic UI component, not the React module! component: tabs This is the name of the generic UI component, not the React module! labels Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: app bar This is the name of the generic UI component, not the React module! component: tabs This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

7 participants