Material UI:非常強大的CSS架構,materialuicss架構

來源:互聯網
上載者:User

Material UI:非常強大的CSS架構,materialuicss架構

Material UI 是一款功能非常強大,介面卻十分清新簡潔的CSS架構,Material UI利用了Google的Material Design 全新設計語言,並且讓每一個UI組件都變得非常獨立,因此開發人員使用Material UI也會比較簡單。和Bootstrap類似,Material UI提供了很多常用的UI組件,除了最基本的菜單、按鈕、滑動杆、進度條、單選框/複選框外,它還提供了一個非常有趣的行事曆群組件,另外還提供了一些很有趣的表徵圖。

Material UI 的特點
  • 組件很豐富,每一個組件的風格比較一致。
  • 提供了 npm 包的形式,使用起來相對比較方便。
  • 這一切都是開源的,你可以任意使用這個開源的CSS架構。
Material UI 的應用執行個體

首先我們從最基本的看起。

菜單

下面是一個簡單的多級下拉式功能表

代碼如下:

nestedMenuItems = [    { type: mui.MenuItem.Types.NESTED, text: 'Reports', items: [      { payload: '1', text: 'Nested Item 1' },      { type: mui.MenuItem.Types.NESTED, text: 'Nested Item 2', items: [        { payload: '1', text: 'Nested Item 2.1' },        { type: mui.MenuItem.Types.NESTED, text: 'Nested Item 2.2', items: [          { payload: '1', text: 'Nested Item 2.2.1' },          { payload: '3', text: 'Nested Item 2.2.2' }        ] },        { payload: '3', text: 'Nested Item 2.3' }      ] },      { payload: '3', text: 'Nested Item 3' },      { type: mui.MenuItem.Types.NESTED, text: 'Nested Item 4', items: [        { payload: '1', text: 'Nested Item 4.1' },        { type: mui.MenuItem.Types.NESTED, text: 'Nested Item 4.2', items: [          { payload: '1', text: 'Nested Item 4.2.1', disabled: true },          { payload: '3', text: 'Nested Item 4.2.2' }        ] },        { payload: '3', text: 'Nested Item 4.3' }      ] },      { payload: '4', text: 'Nested Item 5' }    ] },    { payload: '1', text: 'Audio Library'},    { payload: '2', text: 'Settings'},    { payload: '3', text: 'Logout', disabled: true}  ];<Menu menuItems={nestedMenuItems} autoWidth={false}/>

下面是一個帶表徵圖的垂直菜單

代碼如下:

//iconClassName is the classname for our icon that will get passed into mui.FontIconiconMenuItems = [   { payload: '1', text: 'Live Answer', iconClassName: 'muidocs-icon-communication-phone', number: '10' },   { payload: '2', text: 'Voicemail', iconClassName: 'muidocs-icon-communication-voicemail',  number: '5' },   { payload: '3', text: 'Starred', iconClassName: 'muidocs-icon-action-stars', number: '3' },   { payload: '4', text: 'Shared', iconClassName: 'muidocs-icon-action-thumb-up',  number: '12' }];<Menu menuItems={iconMenuItems} autoWidth={false}/>
按鈕

下面是簡單的彩色按鈕,點擊按鈕會出現波浪擴散的動畫效果。

代碼如下:

//Raised Buttons<RaisedButton label="Default" /><RaisedButton label="Primary" primary={true} /><RaisedButton label="Secondary" secondary={true} /><div style={styles.container}>  <RaisedButton primary={true} label="Choose an Image">    <input type="file" style={styles.exampleImageInput}></input>  </RaisedButton></div><div style={styles.container}>  <RaisedButton linkButton={true} href="https://github.com/callemall/material-ui" secondary={true} label="Github">    <FontIcon style={styles.exampleButtonIcon} className="muidocs-icon-custom-github"/>  </RaisedButton></div><RaisedButton label="Disabled" disabled={true} />
美化單選框複選框

下面是Material UI經過美化過的單選框和複選框

代碼如下:

<RadioButtonGroup name="shipSpeed" defaultSelected="not_light">        <RadioButton          value="light"          label="prepare for light speed"          style={{marginBottom:16}} />        <RadioButton          value="not_light"          label="light speed too slow"          style={{marginBottom:16}}/>        <RadioButton          value="ludicrous"          label="go to ludicrous speed"          style={{marginBottom:16}}          disabled={true}/>      </RadioButtonGroup>
行事曆群組件

這是個人覺得最漂亮的CSS行事曆群組件

代碼如下:

//Portrait Dialog<DatePicker  hintText="Portrait Dialog"//Landscape Dialog<DatePicker  hintText="Landscape Dialog"  mode="landscape"/>// Ranged Date Picker<DatePicker  hintText="Ranged Date Picker"  autoOk={this.state.autoOk}  minDate={this.state.minDate}  maxDate={this.state.maxDate}  showYearSelector={this.state.showYearSelector} />

Material UI還有很多有用的CSS UI組件,你可以前往其官方網站下載及學習使用。

 

 

 

本文

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.