material-ui

Why is exporting/importing default ES module properties faster than names module properties?

馋奶兔 提交于 2019-12-01 18:31:23
I'm reading the Material UI documentation, and it states: Notice that in the above example, we used: import RaisedButton from 'material-ui/RaisedButton'; instead of import {RaisedButton} from 'material-ui'; This will make your build process faster and your build output smaller. I cannot find any justification for why the use of default exports makes the build process faster or build output smaller. My manager is asking us to refrain from using default exports, however a smaller build size is an important target for this project. I mentioned this quote by Material UI, and they said to find

Change formatDate in datepicker of material ui

浪子不回头ぞ 提交于 2019-12-01 18:08:39
问题 i using material-ui datepicker component with redux form. It looks amazing by i have a little issue here. When i change the date it appears in my input field as yyyy-mm-dd. I want to change it so as to appear as dd-mm-yyyy. The datepicker has a property called formatDate which takes a function as an input. So i wrote: <Field name="dateFrom" component={DatePicker} hintText="Ημερομηνία από" autoOk formatDate={() => moment().format(DD-MM-YYYY)} /> but it does not seem to work. Do you have any

Internal implementation of “makeStyles” in React Material-UI?

谁都会走 提交于 2019-12-01 17:12:57
问题 The purpose of this question is to understand what is happening under the hood. Every time I found the code with makeStyles() I feel that I am just doing a pure copy paste without understanding what is happening under the hood. So I thought of posting a question here so that some one can help me out. I have seen the below kind of code in many React apps. I was so curious to know what is happening when we make a call to makeStyles() . So I jumped into its definition but I am not able to

What is the benefit of using withStyles over makeStyles?

落花浮王杯 提交于 2019-12-01 14:21:33
问题 Are there different use cases for each? When should one use withStyles over makeStyles? 回答1: The Hook API ( makeStyles/useStyles ) can only be used with function components. The Higher-order component API ( withStyles ) can be used with either class components or function components. They both provide the same functionality and there is no difference in the styles parameter for withStyles and makeStyles . If you are using it with a function component, then I would recommend using the Hook API

How to create material-ui.js file?

ぃ、小莉子 提交于 2019-12-01 10:53:10
I've followed the getting started guide and have the example running, but it seems to load all of the js components from the example lib folder as separate resources. How do I get it to build a single material-ui.js (or material-ui.min.js) file which I just reference from my html? Do I use npm, gulp, browserify, etc? If so, how? I am not at all familiar with the javascript build and packaging tools. I just want a single js file to include in my static resources, like react.min.js npm install material-ui npm install -g webpack webpack node_modules/material-ui/lib/index.js material-ui.js You're

React force background color full height

橙三吉。 提交于 2019-12-01 09:28:35
I have my App.js class which renders as const theme = createMuiTheme({ palette: { primary: lime, secondary: { ...grey, A400: '#00e677' }, error: red } }); class App extends Component { render() { const classes = this.props.classes; return ( <div className={classes.root}> <MuiThemeProvider theme={theme}> <MyApp/> </MuiThemeProvider> </div> ); } } export default withStyles(styles)(App); my root class has this style const styles = theme => ({ root: { width: '100%', height: '100%', marginTop: 0, zIndex: 1, overflow: 'hidden', backgroundColor: theme.palette.background.default, } }); I thought that

material-ui jss-rtl - after using jss-rtl my page is still LTR

若如初见. 提交于 2019-12-01 09:27:18
I'm using material-ui and next and jss-rtl in my react project but there is a problem the page is still ltr after using <JssProvider ...> -rtl component code: import React from "react"; import { create } from 'jss'; import rtl from 'jss-rtl'; import JssProvider from 'react-jss/lib/JssProvider'; import { createGenerateClassName, jssPreset } from 'material-ui/styles'; // Configure JSS const jss = create({ plugins: [...jssPreset().plugins, rtl()] }); // Custom Material-UI class name generator. const generateClassName = createGenerateClassName(); function RTL(props) { return ( <JssProvider jss=

How can I remove the underline of TextField from Material-UI?

北慕城南 提交于 2019-12-01 09:11:05
问题 I want the TextField to be naked(no underline) when using material-ui TextField. I do know that using InputBase from material-ui can achieve this, but I kinda need to use TextField API to achieve this but i did not find the way to do it in the API guide. 回答1: Below is an example of how to remove the underline. :before is used for the default and hover styling and :after is used for the focused styling, so the border needs to be removed for both of those cases. The multiple ampersands (e.g. "&

How can I change the label size of a material ui TextField?

吃可爱长大的小学妹 提交于 2019-12-01 08:40:38
问题 I have a TextField defined as follows: <TextField id="standard-with-placeholder" label="First Name" className={classes.textField} margin="normal" /> And it looks like this: But I want it look like this: The "First Name" text is larger. How can I adjust the label text size? Currently my styles object is empty. I think that should be where the CSS to do this should go, but I'm unsure what the css would look like for the label text. Thanks 回答1: Here's an example of how to modify the label font

How to create material-ui.js file?

坚强是说给别人听的谎言 提交于 2019-12-01 08:15:45
问题 I've followed the getting started guide and have the example running, but it seems to load all of the js components from the example lib folder as separate resources. How do I get it to build a single material-ui.js (or material-ui.min.js) file which I just reference from my html? Do I use npm, gulp, browserify, etc? If so, how? I am not at all familiar with the javascript build and packaging tools. I just want a single js file to include in my static resources, like react.min.js 回答1: npm