React Nested Grid with Material-UI

https://i.stack.imgur.com/toxDA.jpg

I am striving to replicate the layout demonstrated in the image below

So far, I have the following code snippet:

<Grid container justify=“space-between”>
    <Grid container item>
        <Grid item>
            A
        </Grid>
        <Grid item>
            B
        </Grid>
    </Grid>
    <Grid item>
        C
    </Grid>
</Grid>

However, my output appears like this:

A B
C

Can anyone provide guidance on how to achieve the desired outcome?

Answer №1

Make sure to have a container with at least one item inside

    <Container spacing={3}>
      <Item>
        <Container>
          <Item>
              X
          </Item>
          <Item>
              Y
          </Item>
        </Container>
      </Item>
      <Item>
          Z
      </Item>
    </Container>

Answer №2

To achieve this result, follow these steps:

<Grid container justify="space-between">
  <Grid item>
    <Grid container item>
      <Grid item>
        A
      </Grid>
      <Grid item>
        B
      </Grid>
    </Grid>
  </Grid>
  <Grid item>
    C
  </Grid>
</Grid>

Make sure to wrap the AB container with an additional item element that is a child of the parent container.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Background not covering full height despite setting HTML and body heights to 100%

I've been struggling to set my wrapper to 100% height, despite setting the height to 100%. Any solutions? At the moment, my main_wrapper is empty and should have a background color of red. While I'm looking to add a footer using position: fixed ...

Using React Three Fiber to Retrieve Renderer Information

I need help figuring out a way to utilize renderer.info with r3f. Check out the documentation on ThreeJS Doc - WebGLRenderer Since this is an older project, I'm still using class components to call the render method. return ( <React.Fragment> ...

Building a Multifaceted Website using React and Node.js

I've encountered a rather straightforward issue. My goal is to incorporate a second checkout page into my React and Node Website. I initially believed that the solution would be as simple as adding another 'checkout' Route to the Browser Ro ...

Can the value in a JavaScript object be updated dynamically when a button is clicked?

In my JavaScript code, there is an object named annualPlan. Whenever a user submits the HTML form for a specific month, I aim to update the value in the object for that particular month accordingly. For instance, if someone submits August 21 and 200, I w ...

Achieve Perfect Alignment of Text Inside a Floating Div

Currently, I have a div aligned to the right inside another container. The text (date/time) within this right-aligned div needs to be vertically centered without using top padding. Whenever I apply top padding, it shifts my div downwards and disrupts its ...

How about creating a website using a combination of Static HTML and dynamic SEO-friendly Reactjs/Nextjs, along with developing a mobile app using

I must admit, I am fairly new to all of this. With my new business, I want to try coding some things myself as a proof of concept until we can afford to hire professional coders. Our platform will consist of 4 main areas and I'm not certain if my app ...

PHP Random Background Image Selector

I have a PHP code that is currently displaying a random header image every time the page is refreshed. While this works fine, I now need to add specific background-position css properties to some of the images. For instance, I would like 'headerimage ...

What is the best way to ensure this react component is reusable and able to accept a dynamic initial state?

I've managed to create a dynamic input table, but I'm looking for ways to enhance its reusability and dynamism. As it stands, the name and age are hardcoded in the code. If I want to pass additional props like country, region, etc., this current ...

What could be causing a React component to rerender even when the props remain the same?

I developed an application using ReactJS 16.8.5 and React-Redux 3.7.2. Upon loading, the initial store is set, and database subscriptions are established with a Firebase Realtime Database. The app consists of a sidebar, header, and content section. I notic ...

Ensure there is a blank space preceding a table only when the table is being physically printed

I am currently in the process of developing a report card system for students in grades K-6. The report card will display specific tables based on the student's grade level. For example, a 5th grader may not have a "Reading Stage" table displayed on t ...

When adjusting styles using Chrome DevTools with Webpack HMR, the page layout can become distorted

Encountering a peculiar issue: Currently utilizing Webpack in conjunction with Vue-CLI and HMR. On attempting to modify styles via DevTools in the browser, the page itself undergoes unexpected changes - some styles are removed (screenshots provided below) ...

Modifying CSS styles in real-time according to the present data

Is there a way to dynamically change CSS values based on current CSS values? For example, instead of explicitly setting different values like this: .test{ margin-top:100px; } .test:hover{ margin-top:90px; } Is it possible to achieve the same eff ...

Guide to dynamically setting the title and background color of the navigation bar in React Navigation 5

In my current project, I am utilizing React Navigation Bar version 5 and have successfully set the title in App.js. However, I now need to change this title dynamically when the screen is rendered. I attempted to use this.props.navigation.navigate('Ex ...

Error: The middleware function is not recognized | Guide to Transitioning to React Redux Firebase v3

After utilizing these packages for my project, I encountered an error in middleware composition while creating a new react app with create-react-app. Below are the packages I have included. Can someone please help me identify what is missing here? HELP I ...

Access is restricted by Firebase when attempting to utilize the env file

I am in the process of developing a react-app that integrates with Firebase. The typical setup for credentials is as follows: const firebaseConfig = { apiKey: ..., authDomain: ..., projectId: ..., storageBucket: ..., messagingSenderId: ...

The element type provided is incorrect: it should be a string or a class/function, but an object was given instead

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. I'm currently working on an application using React JS with Spring Boot. I have successfully configured webpack, but ...

What is the best way to save a beloved pet for a user who is signed in?

Is there a way to store a favorite pet for a logged-in user using React and Express? I am currently retrieving pets from an API and using PostgreSQL as the database. const favPetDetails = { id, name, media, breeds, location, dista ...

Modifying appearance following an Axios request to a specific URL

Hi there, I've encountered a strange issue while fetching data from axios and attempting to implement pagination. The styling changes when I hover over the select input element. Let me illustrate this with an example: Check out this sandbox link Hov ...

What could be the reason for the CSS stylesheet not functioning properly on mobile devices?

I am a newcomer to web development and currently working on a website for a massage therapist using bootstrap. However, I am facing an issue where my CSS styles are not displaying correctly on mobile devices. The backgrounds and bootstrap navbar disappear, ...

Issue: Incompatibility between React and TypeScript leading to an error message - "No

When I try to map through an array in my code, I encounter a significant error as shown below: // Home.tsx render() { const { inputs, outputs, expectedOutputs } = this.state; return ( <ContentContainer> {inputs.map((inpu ...