material-ui

Theme dark turns textfield to white

ぐ巨炮叔叔 提交于 2021-01-27 17:18:06
问题 when I try to use the dark theme, it turns the text field to white instead of a gray background. Am I doing something wrong ? 1.Create a text field 2.Set the theme to dark import React from "react"; import TextField from "@material-ui/core/TextField"; import { createMuiTheme } from "@material-ui/core/styles"; import { ThemeProvider } from "@material-ui/styles"; const theme = createMuiTheme({ palette: { type: "dark" } }); export default function FilledTextFields() { return ( <ThemeProvider

Make child of Material UI Grid item stretch to fit the remaining height of the parent container

一曲冷凌霜 提交于 2021-01-27 13:48:30
问题 1. Current Appearance I have a Material UI Grid container with 4 Grid items. Within each Grid item is a Typography component containing a title and a Card with some content, as shown below: 2. Desired appearance I would like the Cards to fill the remaining height of the Grid items and not exceed it. This is my desired output: 3. Undesirable appearance (card height = 100%) I have tried making the height of the Cards 100% but this means each Card takes on the height of its parent (the Grid item

Material-UI - How to open Dialog imperatively/programmatically

喜夏-厌秋 提交于 2021-01-27 10:22:26
问题 Normally this is how you use Material-UI's Dialog. The code below is taken from Material-UI's docs export default function AlertDialog() { const [open, setOpen] = React.useState(false); const handleClickOpen = () => setOpen(true); const handleClose = () => setOpen(false); return ( <div> <Button variant="outlined" color="primary" onClick={handleClickOpen}> Open Dialog </Button> <Dialog open={open} onClose={handleClose}> {...} </Dialog> </div> ); } But I want it to create the Dialog

Material-UI - How to open Dialog imperatively/programmatically

此生再无相见时 提交于 2021-01-27 10:20:19
问题 Normally this is how you use Material-UI's Dialog. The code below is taken from Material-UI's docs export default function AlertDialog() { const [open, setOpen] = React.useState(false); const handleClickOpen = () => setOpen(true); const handleClose = () => setOpen(false); return ( <div> <Button variant="outlined" color="primary" onClick={handleClickOpen}> Open Dialog </Button> <Dialog open={open} onClose={handleClose}> {...} </Dialog> </div> ); } But I want it to create the Dialog

How to programmatically expand or collapse Tree Item in Material Ui?

做~自己de王妃 提交于 2021-01-27 04:28:09
问题 Is there any way to programmatically expand and collapse tree items in material ui? I can do that by clicking on the item, but there are other times when I would like to collapse and expand the tree items based on an action in the tree view. is it possible? 回答1: You can achieve that using TreeView expanded prop. The code below expands the TreeItem with id "1" on mount. import React, {useEffect, useState} from 'react'; import TreeView from '@material-ui/lab/TreeView'; import ExpandMoreIcon

How to programmatically expand or collapse Tree Item in Material Ui?

∥☆過路亽.° 提交于 2021-01-27 04:27:09
问题 Is there any way to programmatically expand and collapse tree items in material ui? I can do that by clicking on the item, but there are other times when I would like to collapse and expand the tree items based on an action in the tree view. is it possible? 回答1: You can achieve that using TreeView expanded prop. The code below expands the TreeItem with id "1" on mount. import React, {useEffect, useState} from 'react'; import TreeView from '@material-ui/lab/TreeView'; import ExpandMoreIcon

Prevent auto focus of a material-ui popover element

北慕城南 提交于 2021-01-27 03:53:39
问题 I am attempting to create a search match list that updates as the user types in their query. However, I can't figure out how to maintain focus on the input element. The pop-up always gets focussed. I have tried programmatically setting the focus using refs but I cannot give a stateless function component (I'm assuming this is my TextField input) a ref. Here is a gif of the behavior. https://imgur.com/a/JVskedr Notice how the popup steals focus and prevents the user from typing further.

Prevent auto focus of a material-ui popover element

有些话、适合烂在心里 提交于 2021-01-27 03:50:26
问题 I am attempting to create a search match list that updates as the user types in their query. However, I can't figure out how to maintain focus on the input element. The pop-up always gets focussed. I have tried programmatically setting the focus using refs but I cannot give a stateless function component (I'm assuming this is my TextField input) a ref. Here is a gif of the behavior. https://imgur.com/a/JVskedr Notice how the popup steals focus and prevents the user from typing further.

How to set default value in material-UI select box in react?

让人想犯罪 __ 提交于 2021-01-26 03:09:09
问题 I am using Select box from material-ui I want to show "select the value" option by default selected but after that user is not able to select this option. <FormControl required className={classes.formControl}> <InputLabel htmlFor="circle">Circle</InputLabel> <Select value={circle} onChange={event => handleInput(event, "circle")} input={<Input name="circle" id="circle" />} > <MenuItem value="" disabled> <em>select the value</em> </MenuItem> <MenuItem value={10}>Ten</MenuItem> <MenuItem value=

How to set default value in material-UI select box in react?

折月煮酒 提交于 2021-01-26 03:08:50
问题 I am using Select box from material-ui I want to show "select the value" option by default selected but after that user is not able to select this option. <FormControl required className={classes.formControl}> <InputLabel htmlFor="circle">Circle</InputLabel> <Select value={circle} onChange={event => handleInput(event, "circle")} input={<Input name="circle" id="circle" />} > <MenuItem value="" disabled> <em>select the value</em> </MenuItem> <MenuItem value={10}>Ten</MenuItem> <MenuItem value=