News Articles material-ui

How can i do Inset FAB using Material UI in React?

i’m currently i’m working in a project that is required to have a "Inset Fab" button between containers. I saw in the Material Design documentation that the name of the component is called "Inset FAB", i’d got some tutorials on google (but didn’t find many) on how to implement, but normally they are "workaround" (setting […]

Mapping data from mongoDB to Mat UI DataGrid

I am trying to map data that is queried by my backend to my front end Material UI DataGrid component. I am running into an issue where my page loads for a moment, it queries my database, and I can see it try to render the data, but it goes to a white page. I […]

Why navigate is not working properly via buttons?

I’m having a small issue this didn’t happen on previous updates of react-router-dom however I’m now using V6 and I don’t understand why this is happening cause it really does not make sense to me. So when I click on Home while being in another path it should take me to the HOME path right […]

dynamic default value in Text Field of react material ui

I’m trying to create a form with two input fields, one is Select, and the other is TextField. I want to dynamically assign a default value to the TextField based on the value of the Select field. Below is my select form control <Select labelId="existingCompanyName" id="existingCompanyName" className={classes.myTextFieldRoot} name="existingCompanyName" label="Existing Company Name" variant=’outlined’ onChange={handleSelectChange} value={existingCompanyID} > […]

Calculate sizes for theme component

I want to be able to calculate the style for a variable based on the theme values from MUI. In the code snippet below, is there a way to retrieve metadata around an IconButton where the variant is small so that I don’t need to hardcode these values? const Header = styled(‘div’)(({ theme }) => […]

White-labeling in reactjs with Materail-UI and Tailwind

I have a react setup in which I am using Tailwind and Material-UI. I have a component library in the Storybook which has MUI Theme in it to style the variants like button outline. I am trying to find a way of how can I use these two things to make the react app white-labeled. […]

Regular ClassName with Material UI

I’ve read some answers to similar questions but did not fully understand because of materialUI update where @mui/styles are depricated. According to mui docs we can create custom styling using sx prop, smth like this <Typography variant="h5" sx={{backgroundColor: ‘red’ }}>Header</Typography> But when I use regular classNames in v5 it works well too: //css .makeRed { […]

My menu component of material ui is giving my page an extra margin to the right when i click on the menu icon

This is my menu component. <Menu id="Menu-Btn" aria-labelledby="Menu-Btn" anchorEl={anchorEl} open={open} onClose={handleClose} anchorOrigin={{ vertical: "top", horizontal: "left", }} transformOrigin={{ vertical: "top", horizontal: "left", }} TransitionComponent={Fade} PaperProps={{ style: { marginTop: "40px", }, }} > When i click on the menu icon one rendering MenuItems my whole page gets a margin of right Source: React – Stack Overflow

Update TextField from MUI in conjunction with react-hook-form. onChange is not being called

const [userData, setUserData] = useState({ fullName: "", email: "", }); // Local component state const onChange = (event) => { console.log(; }; // Evente handler <Grid container spacing={1}> <Grid item xs={12} sm={12}> <TextField required id="name" name="fullName" onChange={onChange} label="Name" InputLabelProps={{ shrink: true }} fullWidth value={userData.fullName} margin="dense" /> <Typography variant="inherit" color="textSecondary"> {errors.fullName?.message} </Typography> </Grid> <Grid item xs={12} […]

Broswer incompatibility for styling an TreeItem component

I’m using Material-UI with React. Currently I’ve built a tree with TreeView and TreeItem components. I need to show inactivate nodes with a different background-color. The problem is in Chrome, if a node has only one child, the child also takes that background-color, but in Firefox, everything is fine. Also I have some dashed line […]

Specified font only applies after refresh in Next JS / Material UI

When I’m redirected to a page, the font I specified in the CSS file only applies AFTER I manually refresh the page. Click sign out (account.js) Redirected to page to enter credentials (login.js) I expect the font (in this case Carter One) to apply right away but instead I get the Railway default in "Successfully […]

How to see create a page of the details of a single product from an Ecommerce

I am developing an Ecommerce project, I managed to create a product grid and link to an route to the specific product, but i am unable to see the data of the item. My products code is here const Container = styled.div` padding: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; ` const Products = () […]

ReactJS Material-UI makeStyles ‘animation’ not working

In my ReactJS project, I am attaching pseudo elements to a <h1> tag where these pseudo elements should be loaded with an animation. Here is what I have done using makeStyles from @material-ui/core(v4): const useStyles = makeStyles((theme) => ({ "@keyframes loadPrefix": { "0%": { transform: "translateX(-100%)" } }, "@keyframes loadSuffix": { "0%": { transform: "translateX(100%)" […]

How to solve the [ 22. stack frames were collapsed ] in my react app?

When I type the Material UI code in my app and I start my react app on my browser. My app is warning: 22. Stack frames were collpsed. ——————————- Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: […]

javascript – react material ui pupulate table using API

I am trying to populate the StickyTable template in react. I am not seeing anyhting in my console log but an empty array. Is there anything obvious that I am missing in my code? I cannot seem to figure out where I am going wrong with this and perhaps a second pair of eyes could […]

can’t change background color in theme Material-UI

I have been trying to define a custom theme using material UI and defining a default background colour for it. But the changes are not taking effect while other pallete options are working. Can anybody tell me what I’m doing wrong? As far as I can tell this is the way to change the colour. […]

How to override css properties of Material UI components

I am working on project in which I have to use Material UI, just for simplicity, consider I am having a simple functional component in which I am having 2 Material UI components Button and Text Field import React from ‘react’; import { Button, TextField } from ‘@material-ui/core’; function RenderComponent(){ return( <> <Button variant="contained">Contained</Button> <TextField […]

Why is my express react application not loading?

Why is it so difficult to post on here, everything I type in the title is not accepted so sorry it does not make sense. Hello everyone! I’m having this error Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.