Skip to content

Commit

Permalink
Merge pull request mui#1716 from shaurya947/v0.12-theming-documentation
Browse files Browse the repository at this point in the history
V0.12 theming documentation
  • Loading branch information
shaurya947 committed Sep 24, 2015
2 parents 84ee0c0 + c1fc863 commit ebc4c50
Show file tree
Hide file tree
Showing 8 changed files with 374 additions and 450 deletions.
43 changes: 8 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,60 +41,33 @@ Material-UI was designed with the [Roboto](http://www.google.com/fonts/specimen/

## Usage

Once material-ui is included in your project, you can use the components this way:
Using material-ui components is very straightforward. Once material-ui is included in your project, you can use the components this way:

```js
// get constant references to React and Material-UI
// components, as we will not be modifying these
//Basic React component that renders a material-ui
//raised button with the text "Default"

const React = require('react');

// it is good practice to require only those components of
// Material-UI that your app needs, instead of requiring all of
// Material-UI. This will make your build process faster and
// your build output smaller

const RaisedButton = require('material-ui/lib/raised-button');

// see node_modules/material-ui/lib/index.js for a mapping of
// Material-UI components to require() calls

const MyAwesomeReactComponent = React.createClass({

childContextTypes: {
muiTheme: React.PropTypes.object
},

getChildContext() {
return {
muiTheme: ThemeManager.getCurrentTheme()
};
},

render() {
return (
<RaisedButton label="Default" />
);
}

},
});


module.exports = MyAwesomeReactComponent;

```

### Theme

**Please note that since v0.8.0, you also need to define a theme for components to start working.** For instructions on implementing and using themes, visit our [documentation](http://material-ui.com/#/customization/themes).

## Customization

Material-UI components have their styles defined inline. There are two approaches to overriding these styles:

* Override individual component styles via the `style` prop
* Define a Theme to apply overarching style changes
We have implemented a default theme to render all Material-UI components. Styling components to your liking is simple and hassle-free. This can be achieved in the following two ways:

This allows you to override variables used by components without having to modify material-ui source files directly.
* [Use a custom theme to style components](http://material-ui.com/#/customization/themes)
* [Override individual component styles via the `style` prop](http://material-ui.com/#/customization/inline-styles)

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ const InlineStyles = React.createClass({
<p>
If you would like to override a style property that has been defined
inline, define your override via the style prop as demonstrated in
the example above. The style prop is an object that applies its
the example above. These overrides take precedence over the theme (if any) that is used
to render the component. The style prop is an object that applies its
properties to the <b>root/outermost element</b> of the component. Some
components provide additional style properties for greater styling
control. If you need to override the inline styles of an element
Expand Down
Loading

0 comments on commit ebc4c50

Please sign in to comment.