How to integrate Nextjs + styled-components with material-ui

Give this a try _document.js import React from ‘react’; import Document, { Head, Main, NextScript } from ‘next/document’; import { ServerStyleSheet } from ‘styled-components’ import { ServerStyleSheets } from ‘@material-ui/styles’; import theme from ‘../src/theme’; class MyDocument extends Document { static async getInitialProps (ctx) { const styledComponentsSheet = new ServerStyleSheet() const materialSheets = new ServerStyleSheets() const … Read more

How to use Material-ui@next TextField error props

Using a react component state, one can store the TextField value and use that as an indicator for an error. Material-UI exposes the error and helperText props to display an error interactively. Take a look at the following example: <TextField value={this.state.text} onChange={event => this.setState({ text: event.target.value })} error={text === “”} helperText={text === “” ? ‘Empty … Read more

Dialog width Material UI

Add two props fullWidth and maxWidth=”md” in your Dialog component like this : <Dialog {…your_other_props} fullWidth maxWidth=”sm” > {/* Your dialog content */} </Dialog> You can change md to sm, xs, lg and xl as per your requirement.

How can I use ref in TextField

String refs are deprecated and material-ui does not support using them. I recommend reading: https://reactjs.org/docs/refs-and-the-dom.html Also to get a ref to the <input /> element you should use the inputRef prop. Read about it here. If your React is up to date you should use createRef or the useRef hook. Below are some examples // … Read more

How to style FormControlLabel font size

You could define the label as a Typography component and apply the style there: <FormControlLabel control={<Checkbox value=”Hello” color=”primary” />} label={<Typography style={styles.formControlLabel}>World</Typography>} /> UPDATE: As per Saber’s comment, newer versions should instead use: <FormControlLabel control={<Checkbox value=”Hello” color=”primary” />} label={<Typography className={styles.formControlLabel}>World</Typography>} />

Material UI: “The key provided to the classes property is not implemented”

The warnings are caused by this line in your demo.js file: <Items {…this.props} items={items} /> You’re spreading all of List‘s props down into your Items. One of these props is classes, containing all of the CSS classes you define in demo.js. Since those are intended for List, they include CSS classes that are implemented by … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)