UNPKG

1.71 kBMarkdownView Raw
1# React Button
2
3A React version of an [MDC Button](https://github.com/material-components/material-components-web/tree/master/packages/mdc-button).
4
5## Installation
6
7```
8npm install @material/react-button
9```
10
11## Usage
12
13### Styles
14
15with Sass:
16```js
17import '@material/react-button/index.scss';
18```
19
20with CSS:
21```js
22import '@material/react-button/dist/button.css';
23```
24
25### Javascript Instantiation
26```js
27import React from 'react';
28import Button from '@material/react-button';
29
30class MyApp extends React.Component {
31 render() {
32 return (
33 <Button>
34 Click Me!
35 </Button>
36 );
37 }
38}
39```
40
41## Props
42
43Prop Name | Type | Description
44--- | --- | ---
45className | String | Classes to be applied to the root element.
46raised | Boolean | Enables raised variant.
47unelevated | Boolean | Enables unelevated variant.
48outlined | Boolean | Enables outlined variant.
49dense | Boolean | Enables dense variant.
50icon | Element | Icon to render within root element.
51trailingIcon | Element | Icon to render on the right side of the element
52children | String | Text to be displayed within root element.
53disabled | Boolean | Disables button if true.
54href | String | Sets a hyperlink & uses anchor tag instead of a button.
55
56## Sass Mixins
57
58Sass mixins may be available to customize various aspects of the Components. Please refer to the
59MDC Web repository for more information on what mixins are available, and how to use them.
60
61[Advanced Sass Mixins](https://github.com/material-components/material-components-web/blob/master/packages/mdc-button/README.md#sass-mixins)
62
63## Usage with Icons
64
65Please see our [Best Practices doc](../../docs/best-practices.md#importing-font-icons) when importing or using icon fonts.