material-ui

How to mount styles inside shadow root using cssinjs/jss

早过忘川 提交于 2019-12-06 13:52:27
I'm trying to use https://material-ui.com/ components inside shadow dom, and need a way to inject those styles inside shadow dom. by default material-ui , which uses jss under the hood injects styles in the head of the page. Is that even possible? Can anyone come with an example? This is what my web component looks like, it is a web component that renders a react app that contains material-ui styles. import * as React from 'react'; import { render } from 'react-dom'; import { StylesProvider, jssPreset } from '@material-ui/styles'; import { create } from 'jss'; import { App } from '@myApp/core'

Changing style on <body> element

自闭症网瘾萝莉.ら 提交于 2019-12-06 11:07:39
问题 I am new to React so this may be simple but I cannot for the life of me find anything in the docs because the element is outside the ReactDOM. I am using material-ui for the user interface and that provides two themes: lightBaseTheme (the default) and darkBaseTheme with darker colors. Sort of day and night modes. The problem is that neither apply any styling to the <body> so the page background does not follow the theme. The dark theme uses white text which does not show on the default white

Opening Date/Time Picker programatically in Material UI LIbary

强颜欢笑 提交于 2019-12-06 10:15:41
问题 I'm doing a project which uses React and Material Design. I'd like to go with Material UI, as I need fancy Dat- and Time Pickers, which this Library supplies as components. As I have to set Start- and End-Times and -Dates in a particular step in the app, I'd like to "hop" from one Picker to the next to decrease the Clicks the User has to make, i.e. Click on "Start Date" Input field Picker opens, Date gets selected The closing of the first Picker should open the next Picker (Start Time)

React Router V4 Implement NavLink inside a ListItem using Material UI

偶尔善良 提交于 2019-12-06 07:53:15
I am new to React and I created a simple application with Login and Dashboard page. I have successfully configured my Public Routes and Private Routes with Redirect functionalities. However when I want to implement material-ui/core Things are still quite working well but I can't achieve the UI that I want. Here is my old implementation of my NavBar below: const Navigation = () => { return ( <div> <NavLink exact to="/" activeStyle={{ color: 'red' }}>Home</NavLink> <NavLink to="/about" activeStyle={{ color: 'red' }}>About</NavLink> <NavLink to="/contact" activeStyle={{ color: 'red' }}>Contact<

How to add linear-gradient color to material-ui Chip background?

妖精的绣舞 提交于 2019-12-06 07:22:56
问题 I want to add linear-gradient below color to Material-UI Chip as a background color. Is it possible? linear-gradient(to right bottom, #430089, #82ffa1) I am using Material-UI v0.18.7. <Chip backgroundColor={indigo400} style={{width: 120}}> <Avatar size={32} color={white} backgroundColor={indigo900}>A</Avatar> This is a Chip </Chip> 回答1: Just set the background to the desired gradient in your styles: <Chip style={{width: 120, background: 'linear-gradient(to right bottom, #430089, #82ffa1)'}}>

Webpack + React + Loading CSS of external modules

那年仲夏 提交于 2019-12-06 06:25:33
Webpack/CSS Experts! My NodeJS/React application has the following structure, where I use Webpack 3.8.1 to package & bundle files. -app |--actions |--constants |--components |--containers |--css |--reducers |--store -common -server -webpack |--rules |--css |--javascript |--externals |--paths |--resolve |--webpack.config.js Everything works as expected in development and production but there is one problem that I have been struggling with: External node modules CSS . When I add a new dependency, which comes with some sort of CSS/SCSS/SASS stylesheets and for that matter makes use of className

Having trouble using Appbar + Drawer (Material UI + ReactJS)

跟風遠走 提交于 2019-12-06 05:48:52
问题 I'm trying to do my first app with ReactJS + Material UI but without success. The only thing I want to do is, when I do click in the button on the bar, display a left drawer. I have the following code (App.jsx): import React from 'react'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme'; import AppBar from 'material-ui/AppBar'; import

ReactJS align material-ui elements horizontally

烈酒焚心 提交于 2019-12-06 05:25:11
问题 I am trying to have a radio button next to a text input so essentially a user can input "answers" to a question and mark one preferred. However, Material-UI puts each on it's own line. This is what I currently have : <div> <RadioButton value="light" /> <TextInput hintText="Answer" multiLine = {true} /> </div> 回答1: Just for the record, I managed to align radio buttons using flexboxgrid... Did something like this: <div className="row"> <div className="col-md-2"> Type: </div> <div className="col

Deprecated typography warning when using custom theme in Material-UI

倖福魔咒の 提交于 2019-12-06 05:06:11
In the following code code, I am using a custom theme in Material-UI: import React from "react"; import ReactDOM from "react-dom"; import { MuiThemeProvider, createMuiTheme } from "@material-ui/core/styles"; import Button from "@material-ui/core/Button"; import { purple, green } from "@material-ui/core/colors"; const theme = createMuiTheme({ palette: { primary: purple, secondary: green } }); function App() { return ( <MuiThemeProvider theme={theme}> <Button color="primary">Button1</Button> <Button color="secondary">Button2</Button> </MuiThemeProvider> ); } ReactDOM.render(<App />, document

How to make AppBar component from material-ui-next react to scroll events

假如想象 提交于 2019-12-06 03:57:32
问题 As per Material Design guidelines: Upon scrolling, the top app bar can […] transform in the following ways: - Scrolling upward hides the top app bar - Scrolling downward reveals the top app bar When the top app bar scrolls, its elevation above other elements becomes apparent. Is there any built-in approach to do this in material-ui-next or should it be considered as a new feature? Can you give a hint on how to achieve the animation of the AppBar component as described in the guidelines? 回答1: