material-ui

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

我是研究僧i 提交于 2019-12-20 11:10:02
问题 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)? 回答1: 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

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

北战南征 提交于 2019-12-20 11:09:03
问题 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)? 回答1: 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

How to add multiple classes in Material UI using the classes props

陌路散爱 提交于 2019-12-20 09:14:27
问题 Using the css-in-js method to add classes to a react component, how do I add multiple components? Here is the classes variable: const styles = theme => ({ container: { display: 'flex', flexWrap: 'wrap' }, spacious: { padding: 10 }, }); Here is how I used it: return ( <div className={ this.props.classes.container }> The above works, but is there a way to add both classes, without using the classNames npm package? Something like: <div className={ this.props.classes.container + this.props

Selenide test fails to interact with Material`s checkbox

女生的网名这么多〃 提交于 2019-12-20 07:32:14
问题 Dear stackoverflowers. We are using Selenide framework in our project to write automation tests for UI. We switched to Material-UI recently and faced with technical problems when it comes to simple checkbox. I am trying to select checkbox. SelenideElement rememberMeCheckBox = $(By.cssSelector("input[type=\"checkbox\"]")); rememberMeCheckBox.setSelected(isSelected); But while doing that I get an exception: Element should be visible {input[type="checkbox"]} Element: '<input type="checkbox"

Using props to set '&:hover' background-color

醉酒当歌 提交于 2019-12-20 06:17:41
问题 I'm wrapping Material-UI's chip component so that I can pass in values other than "primary" and "secondary" for the colors prop. I also want to maintain the hover effect if the chip is clickable so that the chip transitions to a different color when the cursor is over it. The colors are passed in as props, so it's easy enough to set the backgroundColor and color : <Chip style={{ backgroundColor: props.backgroundColor, color: props.color }} /> However, since I'd also like to pass in the hover

material ui Tabs unclickable

五迷三道 提交于 2019-12-20 05:52:14
问题 Tabs from material-ui are unclickable. Nothing happens then i click on them. Code is just simple: `var Tabs = React.createClass ({ render: function() { return ( <Tabs> <Tab label="1"> <p>hello 1</p> </Tab> <Tab label="2"/> <p>hello 2</p> </Tab> </Tabs> ); } });` But on the page i see theese tabs with first tab opened and then i click on the second nothing happens. Tried different browsers. What could go wrong? 回答1: You must add this code: var injectTapEventPlugin = require("react-tap-event

Rendering material-ui-next Checkbox inside a Redux Form

点点圈 提交于 2019-12-20 04:34:46
问题 I am having some trouble trying to render a simple material-ui-next checkbox inside a redux-form . I am following the official example and trying to adapt it to the material-ui-next equivalent, since the example is using the older version of material-ui . This is the code that I end up using: const renderCheckbox = ({ input, label }) => ( <FormGroup row> <FormControlLabel control={ <Checkbox checked={input.value ? true : false} onChange={input.onChange} value="checkedA" /> } label="Secondary"

How do I override hover notchedOutline for OutlinedInput

强颜欢笑 提交于 2019-12-20 04:08:03
问题 i upgraded from material ui version 3 to 4 and would like to override: .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline since I think this update introduces the hover state which is changing my current UI. I used createMuiTheme() and have tried the following but none of those worked: MuiOutlinedInput: { root: { '&:hover': { '&$notchedOutline': { borderColor: '#f00', } }, }, } MuiOutlinedInput: { root: { '&$hover $notchedOutline': { borderColor: '#f00', }, }, } what am I doing

react - router withRouter does not inject router

末鹿安然 提交于 2019-12-20 02:34:21
问题 I want to use withRouter on my top-level React component called 'App'. Documentation is here: https://github.com/reactjs/react-router/blob/v2.4.0/upgrade-guides/v2.4.0.md#withrouter-hoc-higher-order-component I use it like this: import React from "react"; import { render } from "react-dom"; import {Router, Link, hashHistory, Route, IndexRoute, withRouter} from "react-router"; import VoteView from "./voteview/Voteview.jsx"; import OverView from "./overview/Overview.jsx"; import AppBar from

how navigate using the MenuItem? material-ui V1

跟風遠走 提交于 2019-12-20 02:34:09
问题 Why it is not clear how a MenuItem makes navigation to other route? for example, when clicks on a menu item, I want to route to '/account' I can manage to achieve that using onclick function, but I am sure that there is an easier way. Pleas tell me about it I want to implement it on my project. By the way, when used the containerElement containerElement={<Link to="/dashboard" />} I get the following error: index.js:2177 Warning: React does not recognize the `containerElement` prop on a DOM