Closed tastycode closed 6 years ago
hi @tastycode, you'll need to wrap your app in the ThemeProvider.
import { Button, ThemeProvider } from 'styled-material-components';
...
export default () => (
<ThemeProvider>
<Button primary>test</Button>
</ThemeProvider>
);
This will use the default Material Design light theme, but if you want to override any properties you can pass in your own theme object. The default theme will overwrite any properties you provide:
<ThemeProvider theme={{ primary: '#ff0000', accent: '#2cd6d6' }}>
<Button primary>test</Button>
</ThemeProvider>
Additionally, you can wrap other smaller components or sections of your app with a nested theme provider to overwrite theme properties just in that component/section.
Using latest stable create-react-app, and latest version of styled-material-components. I get the following error when trying to import and use
<Button primary>test</Button>
. I am importingstyled-material-components
usingimport { Button } from "styled-material-components"