How to make an app bar using React & Material-UI like this?

…衆ロ難τιáo~ 提交于 2019-12-25 04:24:10

问题


How do I make an app bar that looks like this:

I can create the top half of the app bar with the search box but I'm having trouble adding the bottom half. This is my code so far:

      <AppBar
        style={{backgroundColor: MuiTheme.palette.primary1Color, flexWrap: 'wrap'}}
        showMenuIconButton={false}
        title={explorerSearch}
        titleStyle={MuiTheme.title}
        iconClassNameRight='muidocs-icon-navigation-expand-more'
      >
        <Toolbar>
          <ToolbarGroup>
            {this._getContent()}
          </ToolbarGroup>
        </Toolbar>
      </AppBar>

This is what the output looks like:

I'd like the "TEXT" to show up in a new line below the search bar. How do I do that?


回答1:


Have you tried adding to styles flexDirection: 'column'?

Just replace the style You got there:

style={{backgroundColor: MuiTheme.palette.primary1Color, flexWrap: 'wrap'}}

to

style={{backgroundColor: MuiTheme.palette.primary1Color, display: 'flex', flexDirection: 'column'}}


来源:https://stackoverflow.com/questions/40026643/how-to-make-an-app-bar-using-react-material-ui-like-this

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!