material-ui

What is the purpose of boolean values for the breakpoint props (xs, sm, md…) in material-ui

帅比萌擦擦* 提交于 2020-01-02 09:02:29
问题 I am struggling to find documentation on (or results via experimenting with code) what the purpose is of having booleans as values for breakpoint props for the grid component in material-ui. Consulting the grid api documentation reveals that booleans are valid values for the breakpoint props lg, md, sm, xl, xs. I understand that if I say sm={3} I will get a component that changes to take up 3 grid column units once the display width increases beyond the xs breakpoint (600px) but have no idea

material ui next dialog textfield underline color

可紊 提交于 2020-01-02 08:07:42
问题 How can I change the underline color of a textfield inside a dialog with my secondary palette color? I couldn't do it since the documentation it's quite confusing 回答1: Assuming you are using material-ui-next, you can use overrides in createMuiTheme . import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles'; const theme = createMuiTheme({ overrides: { MuiInput: { underline: { '&:before': { //underline color when textfield is inactive backgroundColor: 'red', }, '&:hover:not(

How to use pseudo selectors in material-ui?

自闭症网瘾萝莉.ら 提交于 2020-01-02 00:14:13
问题 I have been trying to achieve the simple thing. I was trying to show/hide my <TreeMenu/> component in the material UI v1 with pseudo selectors but somehow it does not work. Here is the code : CSS: root: { backgroundColor: 'white', '&:hover': { backgroundColor: '#99f', }, }, hoverEle: { visibility: 'hidden', '&:hover': { visibility: 'inherit', }, }, rootListItem: { backgroundColor: 'white', display: 'none', '&:hover': { display: 'block', backgroundColor: '#99f', }, }, '@global': { 'li > div

How to style Material-UI's tooltip?

只谈情不闲聊 提交于 2020-01-01 08:57:11
问题 How can I style Material-UI's tooltip text? The default tooltip on hover comes out black with no text-wrap. Is it possible to change the background, color etc? Is this option even available? 回答1: This answer is out of date. This answer was written in 2016 and Material-UI has gone through significant changes since then. Please see this answer for an approach that works with the current version (3.9.2 at this time). well, you can change the text color and the element background customizing the

styled-components typescript error with Material-UI component

*爱你&永不变心* 提交于 2020-01-01 05:25:05
问题 Using typescript and want to set styling for Material UI component with styled-components. But type error happens with StyledComponent showing Type '{ children: string; }' is missing the following properties import React, { PureComponent } from 'react'; import styled from 'styled-components'; // ^4.1.3 import { Button } from '@material-ui/core'; // ^3.9.1 class TestForm extends PureComponent { render() { return ( <> <Button style={{ backgroundColor: 'red' }}>Work</Button>{/* OK */}

How to use useStyle to style Class Component in Material Ui

让人想犯罪 __ 提交于 2019-12-30 10:08:08
问题 I want to use useStyle to style the Class Component . But this can be easily done hooks. but i want to use Component instead. But I cant figure out how to do this. import React,{Component} from 'react'; import Avatar from '@material-ui/core/Avatar'; import { makeStyles } from '@material-ui/core/styles'; import LockOutlinedIcon from '@material-ui/icons/LockOutlined'; const useStyles = makeStyles(theme => ({ '@global': { body: { backgroundColor: theme.palette.common.white, }, }, paper: {

How to style material-ui textfield

狂风中的少年 提交于 2019-12-30 03:43:11
问题 I have been trying to work out how to style a material-ui.next textfield component. <TextField id="email" label="Email" className={classes.textField} value={this.state.form_email} onChange={this.handle_change('form_email')} margin="normal" /> My classes are created as follows: const styles = theme => ({ textField: { width: '90%', marginLeft: 'auto', marginRight: 'auto', color: 'white', paddingBottom: 0, marginTop: 0, fontWeight: 500 }, }); My problem is that I can not seem to get the colour

Can't style datepiker popup dialog

元气小坏坏 提交于 2019-12-29 07:52:18
问题 I have a problem with customizing the datepicker popup dialog(For example change color of header). I can't style it by attribute style like textField by textFieldStyle. It doesn't have any class or id. How can I do it? 回答1: The only place you can currently override this is the theme: import React from 'react'; import {cyan500} from 'material-ui/styles/colors'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import

Intercept/handle browser's back button in React-router?

℡╲_俬逩灬. 提交于 2019-12-28 02:49:45
问题 I'm using Material-ui's Tabs, which are controlled and I'm using them for (React-router) Links like this: <Tab value={0} label="dashboard" containerElement={<Link to="/dashboard/home"/>}/> <Tab value={1} label="users" containerElement={<Link to="/dashboard/users"/>} /> <Tab value={2} label="data" containerElement={<Link to="/dashboard/data"/>} /> If I'm currenlty visting dashboard/data and I click browser's back button I go (for example) to dashboard/users but the highlighted Tab still stays

several instances of `@material-ui/styles` initialized in this application

Deadly 提交于 2019-12-25 19:12:47
问题 I developed NPM and install @material-ui/core npm to use styles but when I am using that package in my application it gives me warning there are several instances of @material-ui/styles initialized in this application and style not apply in my project. Thanks. 来源: https://stackoverflow.com/questions/59351557/several-instances-of-material-ui-styles-initialized-in-this-application