react-mdc-web
Version:
React web components for Material Design
76 lines (63 loc) • 2.76 kB
Markdown
[![Maintenance Status][status-image]][status-url] [![NPM version][npm-image]][npm-url] [![Travis build][travis-image]][travis-url]
React components based on styles from [Material Design Components Web project](https://github.com/material-components/material-components-web). Components are written in React.js. Doesn't use MDC foundation classes.
From CDN
```html
<script src="https://unpkg.com/react-mdc-web/out/react-mdc-web.js"></script>
```
From package manager
```sh
npm i --save react-mdc-web
```
* Include CSS with default theme into HTML page
```html
<link rel="stylesheet" href="https://unpkg.com/material-components-web@0.23.0/dist/material-components-web.min.css">
```
* Or import it into JS/JSX file
```javascript
// MyApp/index.js
import 'material-components-web/dist/material-components-web.min.css';
```
Override default theme colors with Sass or with CSS Custom Properties, just follow these guides:
* [Changing the theme with Sass](https://github.com/material-components/material-components-web/blob/master/docs/theming.md#step-3-changing-the-theme-with-sass)
* [Changing the theme with CSS Custom Properties](https://github.com/material-components/material-components-web/blob/master/docs/theming.md#step-4-changing-the-theme-with-css-custom-properties)
```js
import React, { Component } from 'react'
import {Card, CardHeader, CardTitle, CardText, CardActions, Button} from 'react-mdc-web/lib';
class MyComponent extends Component {
render() {
return (
<Card>
<CardHeader>
<CardTitle>
Title goes here
</CardTitle>
</CardHeader>
<CardText>
Lorem ipsum dolor sit amet, sint adipiscing ius eu
</CardText>
<CardActions>
<Button compact>Save</Button>
<Button compact accent>Remove</Button>
</CardActions>
</Card>
);
}
}
```
More samples could be found on the [Documentation Site](https://kradio3.github.io/react-mdc-web/)
MIT, see [LICENSE](/LICENSE) for details
[]: https://img.shields.io/badge/status-maintained-brightgreen.svg
[]: https://github.com/kradio3/react-mdc-web
[]: https://img.shields.io/npm/v/react-mdc-web.svg
[]: https://www.npmjs.com/package/react-mdc-web
[]: https://travis-ci.org/kradio3/react-mdc-web.svg?branch=master
[]: https://travis-ci.org/kradio3/react-mdc-web
[]: https://img.shields.io/badge/license-MIT-blue.svg
[]: https://raw.githubusercontent.com/kradio3/react-mdc-web/master/LICENSE