score:1
Accepted answer
The simplest way to make it work as expected is to assign a maximum height of viewport (height: 100vh
) to your box component.
...
<Box component="main"
sx={{
flexGrow: 1,
p: 3,
width: { sm: `calc(100% - ${drawerWidth}px)` },
height: '100vh',
color: "#fff",
backgroundColor: "#212121"
}}>
<Toolbar />
<Typography paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
</Typography>
</Box>
...
Working example:
Note: your solutions won't work because of the following:
height
property with a percentage value will be inherited from the parent element since the parent elementheight
by default isauto
(which is inherited from its parent too), so it won't work as expected.flex
property won't work as expected because theflex-direction
will berow
by default. But it also won't work if you change it tocolumn
since the maximum height of the container isauto
and it follows the same rule as above.
Source: stackoverflow.com
Related Query
- React js material ui problem box inside responsive drawer
- React material ui responsive drawer - I want to remove the padding from the Toolbar
- Connect React Material UI: Mini Variant + Responsive drawer
- React Material Ui responsive drawer
- react material ui not responsive when opened in mobile browser
- React Router V4 Implement NavLink inside a ListItem using Material UI
- React Formik Material UI Autocomplete: How can I populate value inside of autocomplete from localStorage?
- Add text inside the Doughnut chart of the React-Chartjs-2 box to react
- How to use React Router with Material UI Drawer to change content on click?
- Material UI Table not being responsive while using example Responsive Drawer
- React Material UI Drawer - Warning Each child in a list should have a unique "key" prop
- Remove blue outline from Select box React Material UI
- material ui styles inside react component
- Slider inside of Modal is not working - React + Material UI
- React MUI: Persistent + Responsive drawer
- React Material UI: Box not scroll-able in y-axis
- Add component inside TabPanel from Material UI React
- React Material UI - Responsive CardMedia
- Problem with using map to populate select in React / Material UI
- Add icon inside text input in Material UI and React
- Click on radio button and display the corresponding value inside the radio button as selected in react js material UI design
- How to remove curved border and inset box shadow from Material UI TextField React component?
- I want to select the text inside input box by clicking on a button in react js but my code doesn't work
- Put cursor inside input box onChange in React
- React + Material Design Lite - How to close navigation drawer when menu link is clicked?
- How to put the icon inside the React Material Ui text field?
- Element positioned absolute inside Dialog Material UI React
- I need to show a react material ui confirmation dialog box or a sweet alert confirmation dialog box in handlesubmit function
- I am having problem when adding a working update button inside material ui datagrid v5.6.1
- React - Display all items inside localStorage as a Material UI List
More Query from same tag
- React history push not rendering the component
- Interacting with React components from non-react world
- React + Mapbox: Sample implementation of `getRenderedFeatures` in Deck.gl?
- Heroku, NodeJs and React issue: SCRIPT5007: Unable to get property 'apply' of undefined or null reference
- mapDispatchToProps with react-redux' connect() and class components
- Unable to load @webpack-cli/serve
- How would I "Map" through Nested Json
- React: How to get results from one component to another component
- react firebase - filtering firebase fetched items by user uid value
- I am not able re-render the state once it is updated
- RTK Query: Accessing cached data outside of a react component
- Type error: Type 'string' is not assignable to type 'Colors'
- Redirect to new page using functional component in Card Material UI
- React authorizing user access
- How to stop DraftJS cursor jumping to beginning of text?
- conditionally show after pseudo element react and styled components
- Minified React error in react while navigation one component to anther
- How to handle the `onKeyPress` event in ReactJS?
- How to test a custom hook event with Enzyme and Jest? (useKeyPress)
- Is there a way to limit Material UI TextFields of input type = file to accept only pdf?
- Update component state on route-change? (react-router)
- Page 404 appears in all routes of React Router
- How can i disable props checking when jsx type is a function?
- React functional component destructuring
- Creating a React CSS object with clamp and focus
- In terms of Redux, is the view render what triggers the store to set up the initial sate? Or is the store initially set up first anyway?
- How to asynchronously set state in useState hook React
- How can I remove the current card?
- Using specific child components with a generic parent component
- How to fix Show div on scroll (React)