2017-04-08 75 views
0

我想自定義TextField的浮動標籤。如何自定義Material UI中的子組件

我知道創建一個新的工程如下圖,但有沒有更好的方法?

import TextFiled from 'material-ui/TextField'; 
 

 
class TextFiledNew extends Component { 
 
    static propTypes = { 
 

 
    } 
 
    render() { 
 
     return (
 
      <TextFiled 
 
       floatingLabelFixed={true} 
 
       floatingLabelStyle = {{top: '88px', textTransform: 'uppercase', letterSpacing: '0.1em'}} 
 
      /> 
 
     ) 
 
    } 
 
} 
 

 
module.exports = TextFiledNew

我試着不斷變化的主題的方式,但它不工作。

const muiTheme = getMuiTheme({ 
 
    textField: { 
 
     floatingLabel:{ 
 
      top: '88px', 
 
      textTransform: 'uppercase', 
 
      letterSpacing: '0.1' 
 
     } 
 
    } 
 
});

回答

0

這工作就好了!我們在material-ui中使用幾個組件,並在它們周圍使用自定義包裝。我們的EnhancedMenuItem讓我們在某些情況下添加一些可選的圖標和轉換。絕對要試用圖書館,並做出自己的修改,以使其完全適合您的需求。

相關問題