react-material

Overriding Styles in Material UI in React

若如初见. 提交于 2021-02-16 20:27:33
问题 I have a problem overriding the styles in my theme in Material UI in React. I wanted to customize the border of columnsContainer but it isn't working. only the root is working well. Check Here for Codesanbox MuiDataGrid.js export default { root: { backgroundColor: "white", border: `1px solid green`, "& .columnsContainer": { borderBottom: `1px solid 'blue' !important` } } }; 回答1: Below is the correct syntax. The changes compared to your code sandbox are: Replace .columnsContainer with

How i can remove the blue border in Material React Modal?

随声附和 提交于 2021-01-28 01:11:34
问题 I'm using this React Material Modal. In the demo examples you can see that when you open the modal, has a blue border. There's a way to remove it? I see in the Modal Api that haves the property disableAutoFocus but i'm setting "true" and my modal still have this blue border: <Modal disableAutoFocus="true" aria-labelledby="transition-modal-title" aria-describedby="transition-modal-description" className={classes.modal} open={open} onClose={handleClose} closeAfterTransition BackdropComponent=

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 use data attributes with Material Design React?

依然范特西╮ 提交于 2020-12-08 06:53:59
问题 I recently started using Material Design React, but I have just come across that data-someField does propagate the value to the dataset map. Example: <Input data-role=‘someValue’ onChange={this.onChange} /> onChange = e =>{ const role = e.target.dataset.role const role2 = e.currentTarget.dataset.role } Both roles in the onChange handler are undefined. This doesn’t happen if I change the Input tag to a regular html input. Any ideas why Material Design doesn’t allow data attributes or if there

How to use data attributes with Material Design React?

蹲街弑〆低调 提交于 2020-12-08 06:53:03
问题 I recently started using Material Design React, but I have just come across that data-someField does propagate the value to the dataset map. Example: <Input data-role=‘someValue’ onChange={this.onChange} /> onChange = e =>{ const role = e.target.dataset.role const role2 = e.currentTarget.dataset.role } Both roles in the onChange handler are undefined. This doesn’t happen if I change the Input tag to a regular html input. Any ideas why Material Design doesn’t allow data attributes or if there

Get Formik Validation Current Year and Up

天涯浪子 提交于 2020-06-29 03:37:29
问题 I need to get the validation using Formik that input should only be currentYear and up. const currentYear = new Date().getFullYear(); expiryYear: yup .string() .required('Select expiry year') .min(4, `Invalid year format (Example: ${currentYear + 4})`) .max(4, `Invalid year format (Example: ${currentYear + 4})`) .when('startDate', (currentYear, schema) => currentYear && schema.min(currentYear)), 回答1: Try this please: yup.date() .min(new Date().getFullYear(), 'Year must be current year or

Uncaught TypeError: Cannot read property 'main' of undefined when trying to use React MuiAlert

两盒软妹~` 提交于 2020-05-29 08:30:22
问题 I am trying to build a Redux based notificator based on this example: https://material-ui.com/components/snackbars/#CustomizedSnackbars.tsx And here is what I came up with: import { Snackbar } from '@material-ui/core'; import MuiAlert, { AlertProps } from '@material-ui/lab/Alert'; import React from 'react'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { ProgramCategoryActions } from '../../program/store/program-category.actions'; import {

Material UI – Global checkbox focus styling (not locally)

社会主义新天地 提交于 2020-05-23 11:05:21
问题 Trying to alter styling of checkbox when it is focused at a global level using Material-UI (react). At the moment only default and hover styling is working: MuiCheckbox: { colorSecondary: { color: 'green', '&:hover': { color: 'blue !important', border: '1px solid rgba(0,0,0,0.54)', outline: '2px auto rgba(19,124,189,.6)' } }, } What i'm trying to do, but is NOT working: MuiCheckbox: { colorSecondary: { '&$focused': { color: 'blue', border: '1px solid rgba(0,0,0,0.54)', outline: '2px auto rgba

Place MaterialUI Tooltip “on top” of anchor element? (React)

核能气质少年 提交于 2020-05-16 02:59:32
问题 Seems impossible to place <Tooltip> "on top" (stacked/layered above) the triggering anchor element. It always appears outside the parent, using "placement" to decide where. I believe it's the Flip tool within Popper that manages placement and ensures visibility. I've tried passing Popper option modifiers to disable flip, and adjusting the offset. Some recommendations were to skip preventing overflow, and disable GPU acceleration. I'm down a rabbit-hole of MaterialUI internals to accomplish