material-ui

How to apply custom theme in material ui

吃可爱长大的小学妹 提交于 2019-12-03 05:56:51
问题 I am trying to apply a custom theme to my React component after reading this tutorial http://www.material-ui.com/#/customization/themes I wrote my theme in a separate javascript file like this import Colors from 'material-ui/lib/styles/colors'; import ColorManipulator from 'material-ui/lib/utils/color-manipulator'; import Spacing from 'material-ui/lib/styles/spacing'; import zIndex from 'material-ui/lib/styles/zIndex'; export default { spacing: Spacing, zIndex: zIndex, fontFamily: 'Roboto,

Passing props to material UI style

牧云@^-^@ 提交于 2019-12-03 05:43:15
given card code as in here : card how can I update the card style or any material UI style as from const styles = theme => ({ card: { minWidth: 275, }, to such follows: const styles = theme => ({ card: { minWidth: 275, backgroundColor: props.color }, when I tried the latest one, I got Line 15: 'props' is not defined no-undef when I updated code to be : const styles = theme => (props) => ({ card: { minWidth: 275, backgroundColor: props.color }, also const styles = (theme ,props) => ({ card: { minWidth: 275, backgroundColor: props.color }, instead of const styles = theme => ({ card: { minWidth:

I cannot use material-ui components after update to material-ui@0.15.0-beta.1

落爺英雄遲暮 提交于 2019-12-03 04:43:57
I got this message in my console: Failed Context Types: Required context muiTheme was not specified in AppBar AppBar.js:158 Uncaught TypeError: Cannot read property 'prepareStyles' of undefined I just have an AppBar in my Component I think it should work but... here my very simple code: import React from 'react'; import {AppBar} from 'material-ui'; export class MyComponent extends React.Component { render() { return ( <div> <AppBar title="Title" /> </div> ); } } thanks for helping... With material-ui@0.15.0.beta-1 a few things were changed. You can have a look on the link below for more

How to center a component in Material-UI and make it responsive?

北慕城南 提交于 2019-12-03 04:38:54
I don't quite understand the React Material-UI grid system. If I want to use a form component for login, what is the easiest way to center it on the screen on all devices (mobile and desktop)? Since you are going to use this in a login page. Here is a code I used in a Login page using Material-UI <Grid container spacing={0} direction="column" alignItems="center" justify="center" style={{ minHeight: '100vh' }} > <Grid item xs={3}> <LoginForm /> </Grid> </Grid> this will make this login form at the center of the screen. But still IE doesn't support the Material-UI Grid and you will see some

TypeError: Cannot read property &#039;prepareStyles&#039; of undefined

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My Component looks like import React, {PropTypes} from 'react'; import TransactionListRow from './TransactionListRow'; import {Table, TableBody, TableHeader, TableHeaderColumn, TableRow} from 'material-ui/Table'; const TransactionList = ({transactions}) => { return ( <Table> <TableHeader displaySelectAll={false}> <TableRow> <TableHeaderColumn>Name</TableHeaderColumn> <TableHeaderColumn>Amount</TableHeaderColumn> <TableHeaderColumn>Transaction</TableHeaderColumn> <TableHeaderColumn>Category</TableHeaderColumn> </TableRow> </TableHeader>

Overriding with classes in material-ui v1.0.0-beta-1 shows “the key provided to the classes property is not implemented” warning

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to override the styling of Material-UI v1 components, using the overriding by classes method. When I try to override a nested property, for example the :hover pseudo class on the root key I get the following warning: Warning: Material-UI: the key `.MyButton-root-w:hover` provided to the classes property object is not implemented in Button. You can only overrides one of the following: See for example: import React from "react"; import { createStyleSheet, withStyles } from "material-ui/styles"; import Button from "material-ui/Button

How to wrap React component with little performance penalty?

南笙酒味 提交于 2019-12-03 02:02:24
My team uses React MaterialUI library. To provide consistent UI Pattern and make it easy for us to customise MaterialUI's component, we wrap each MaterialUI's component in our own component. For example: const style = {} // our project custom style for ListItemText const OurListItemText = ({primary, secondary, classes}: Props) => ( <MuiListItemText primary={primary} secondary={secondary} className={classes.text} /> ) // we only expose primary and secondary props of the original MuiListItemText. // Team members are blocked from customising other MUIListItemText's props export default withStyles

How to include Roboto font in webpack build for Material UI?

你离开我真会死。 提交于 2019-12-03 01:38:06
问题 For a progressive web app based on Material UI (React) and built with Webpack , how do I properly include Roboto font(s) so that the app does not depend on Google servers and fonts also work offline ? The installation page just references the Google fonts page, but that obviously forces fonts to be downloaded from Google servers. A similar Material UI Issue exists regarding Roboto font, but still relies on Google providing the font files. I found a NPM package providing the Roboto font files,

Creating a navbar with material-ui

坚强是说给别人听的谎言 提交于 2019-12-03 01:22:11
I'm trying to create a simple navbar with material-ui that looks like the one they use on their site . This is the code I wrote to try to replicate it: import React from 'react' import {AppBar, Tabs, Tab} from 'material-ui' class Nav extends React.Component { render() { return ( <AppBar title="My App"> <Tabs> <Tab label="Item 1" /> <Tab label="Item 2" /> <Tab label="Item 3" /> <Tab label="Item 4" /> </Tabs> </AppBar> ) } } React.render(<Nav />, document.body) The problem is, the tabs are coming up very weird and clicking on the tabs have no effect whatsoever. Screenshot: Any help would be very

How to apply custom theme in material ui

社会主义新天地 提交于 2019-12-02 19:26:23
I am trying to apply a custom theme to my React component after reading this tutorial http://www.material-ui.com/#/customization/themes I wrote my theme in a separate javascript file like this import Colors from 'material-ui/lib/styles/colors'; import ColorManipulator from 'material-ui/lib/utils/color-manipulator'; import Spacing from 'material-ui/lib/styles/spacing'; import zIndex from 'material-ui/lib/styles/zIndex'; export default { spacing: Spacing, zIndex: zIndex, fontFamily: 'Roboto, sans-serif', palette: { primary1Color: Colors.cyan500, primary2Color: Colors.cyan700, primary3Color: