Creating a navbar with material-ui

后端 未结 6 1009
予麋鹿
予麋鹿 2021-02-05 03:37

I\'m trying to create a simple navbar with material-ui that looks like the one they use on their site. This is the code I wrote to try to replicate it:

import Re         


        
6条回答
  •  温柔的废话
    2021-02-05 04:07

    Besides the CSS hack, I found out that you can use HTML Entities as a hack to split the tabs text. You can add   to the beginning and ending of the tab labels and you have your space.

    It makes the label string ugly but if you don't care that much it does the work pretty well, and it also allow you to add as many spaces as you wish.

    Here is the updated code:

    import React from 'react'
    import {AppBar, Tabs, Tab} from 'material-ui'
    
    class Nav extends React.Component {
      render() {
        return (
          
            
              
              
              
              
            
          
        )
      }
    }
    
    React.render(

    And screenshot: Tabs with spaces

提交回复
热议问题