material-ui

Material UI and Grid system

倾然丶 夕夏残阳落幕 提交于 2019-11-27 19:45:15
问题 I'm playing a little bit with Material-UI. Are there any options for creating a grid layout (like in Bootstrap)? If not, what is the way to add this functionality? There is a GridList component but I guess it has some different purpose. 回答1: Material UI have implemented their own Flexbox layout via the Grid component. It appears they initially wanted to keep themselves as purely a 'components' library. But one of the core developers decided it was too important not to have their own. It has

React Material UI - Export multiple higher order components

二次信任 提交于 2019-11-27 18:08:57
I'm stuck on exporting material-ui styles with redux connector. Here is my code: import React, { Component } from 'react'; import { connect } from 'react-redux'; import Drawer from 'material-ui/Drawer'; import { withStyles } from 'material-ui/styles'; import PropTypes from 'prop-types'; const mapStateToProps = state => ({}); const reduxConnector = connect(mapStateToProps, null); const styles = theme => { console.log(theme); return ({ paper: { top: '80px', boxShadow: theme.shadows[9] }, }); }; class Cart extends Component { render() { const { classes } = this.props; return ( <Drawer open docked

Use components from two versions of the same library (npm / Material UI in my case)

好久不见. 提交于 2019-11-27 15:08:44
问题 I'm using the latest stable version of Material UI in my production React app. I need the updated Data Tables component, which is currently in Material UI's unstable alpha branch. I don't want to upgrade my whole app with npm i material-ui@next because of the numerous breaking changes. How can I access the alpha library without upgrading my whole library? Can I install two versions of MUI? Can I call on the alpha API without installing it through NPM? Thanks in advance. 回答1: After some

Material-ui adding Link component from react-router

喜欢而已 提交于 2019-11-27 11:34:42
I'm struggling to add <Link/> component to my material-ui AppBar This is my navigation class: class Navigation extends Component { constructor(props) { super(props) } render() { var styles = { appBar: { flexWrap: 'wrap' }, tabs: { width: '100%' } } return ( <AppBar showMenuIconButton={false} style={styles.appBar}> <Tabs style={styles.tabs}> <Tab label='Most popular ideas'/> <Tab label='Latest ideas' /> <Tab label='My ideas' /> </Tabs> </AppBar> ) } } Which looks okay: Tabs are clickable, have fluid animations, that's cool. But how do I wire them up together with react-router and its' <Link/>

How to use materialize-css with React?

自闭症网瘾萝莉.ら 提交于 2019-11-27 10:20:28
问题 I have a Meteor/React project, using ES6 modules. I've installed materialize-css using npm, but I'm not sure how to actually use the Materialize classes in my JSX code. What am I supposed to import from materialize-css? Or do I just have to include the CSS in my main index.html file? I mostly want it for the grid system, as I'll be using material-ui for the actual UI components. 回答1: Since I use CSS Modules, importing materialize css would scope it to that particular component. So I did the

React + Material-UI - Warning: Prop className did not match

戏子无情 提交于 2019-11-27 06:48:40
问题 I'm having difficulty with differences between client-side and server-side rendering of styles in Material-UI components due to classNames being assigned differently. The classNames are assigned correctly on first loading the page, but after refreshing the page, the classNames no longer match so the component loses its styling. This is the error message I am receiving on the Console: Warning: Prop className did not match. Server: "MuiFormControl-root-3 MuiFormControl-marginNormal-4 SearchBar

What does the error “JSX element type '…' does not have any construct or call signatures” mean?

浪尽此生 提交于 2019-11-27 02:59:12
I wrote some code: function renderGreeting(Elem: React.Component<any, any>) { return <span>Hello, <Elem />!</span>; } I'm getting an error: JSX element type Elem does not have any construct or call signatures What does it mean? This is a confusion between constructors and instances . Remember that when you write a component in React: class Greeter extends React.Component<any, any> { render() { return <div>Hello, {this.props.whoToGreet}</div>; } } You use it this way: return <Greeter whoToGreet='world' />; You don't use it this way: let Greet = new Greeter(); return <Greet whoToGreet='world' />

css position absolute making the textbox go down

流过昼夜 提交于 2019-11-27 02:12:19
I build a prototype using chips material-UI. When I click the Test IPA the textbox should show immediately below the text Test IPA. In the prototype, it shows immediately below but whereas when I include with other functionalities, it's showing at the bottom. I debugged the CSS, its due to position absolute for each scenario it's showing different values and its coming from material UI. Can you tell me how to fix it with respect to other components? Providing my code snippet, sandbox and bug screenshot below. Problem with other components https://codesandbox.io/s/qqqk23x3q Working properly

React Material UI - Export multiple higher order components

你。 提交于 2019-11-26 19:18:57
问题 I'm stuck on exporting material-ui styles with redux connector. Here is my code: import React, { Component } from 'react'; import { connect } from 'react-redux'; import Drawer from 'material-ui/Drawer'; import { withStyles } from 'material-ui/styles'; import PropTypes from 'prop-types'; const mapStateToProps = state => ({}); const reduxConnector = connect(mapStateToProps, null); const styles = theme => { console.log(theme); return ({ paper: { top: '80px', boxShadow: theme.shadows[9] }, }); };

Change outline for OutlinedInput with React material-ui

試著忘記壹切 提交于 2019-11-26 17:23:41
问题 Quick note: this is not a duplicate of How to change outline color of Material UI React input component? With material-ui (React) I am unable to delete the outline on hover or focus. The reason I am using this input is to request add a little red border when a warning occurs. I can change the focused and hover styles. This is tested in the following image: Where this CSS is applied when the input is focused: outlinedInputFocused: { borderStyle: 'none', borderColor: 'red', outlineWidth: 0,