"Step-by-step guide on placing an order for the button

I am currently working with material-ui and encountering a roadblock. My goal is to design a homepage for a dashboard where the various services are listed. I am attempting to organize these 6 buttons into 2 rows and 3 columns, totaling 6 buttons in all. As someone who is new to grid logic, I'm struggling to achieve this. Any guidance on how to accomplish this would be greatly appreciated. Thank you. https://i.sstatic.net/BsR3P.png

Essentially, my aim is to maintain this layout across all screens except for mobile devices. https://i.sstatic.net/BMLvZ.png Here is the snippet of code I have been working on:

    const useStyles = makeStyles((theme) => ({
    root: {
    display: 'flex',
    justifyContent: "center",
    marginTop: '300px',

},

}));

export default function Menu() {
const classes = useStyles();
return (
    <div className={classes.root}>
        <Grid container spacing={1}>
            <Grid container item xs={3} spacing={3}>
                <Button
                    style={{ width: '300px', padding: '60px', margin: '15px' }}
                    variant='contained' color='Default'>
                    <AddIcon />Study
                </Button>
            </Grid>
            <Grid container item xs={3} spacing={3}>
                <Button
                    style={{ width: '300px', padding: '60px', margin: '15px' }}
                    variant='contained' color='Default'>
                    <AddIcon />All Studies
                </Button>
            </Grid>
            <Grid container item xs={3} spacing={3}>
                <Button
                    style={{ width: '300px', padding: '60px', margin: '15px' }}
                    variant='contained' color='Default'>
                    <AddIcon />Planning
                </Button>
            </Grid>
            <Grid container item xs={3} spacing={3}>
                <Button
                    style={{ width: '300px', padding: '60px', margin: '15px' }}
                    variant='contained' color='Default'>
                    <AddIcon />Products
                </Button>
            </Grid>
            <Grid container item xs={3} spacing={3}>
                <Button
                    style={{ width: '300px', padding: '60px', margin: '15px' }}
                    variant='contained' color='Default'>
                    <AddIcon />Platform
                </Button>
            </Grid>
            <Grid container item xs={3} spacing={3}>
                <Button
                    style={{ width: '300px', padding: '60px', margin: '15px' }}
                    variant='contained' color='Default'>
                    <AddIcon />Clients
                </Button>
            </Grid>
        </Grid>
    </div>
)
}

Answer №1

Divide your content into two groups using div elements:

<div container className={classes.root}>
  <div>
    <Button
      style={{ width: "300px", padding: "60px", margin: "15px" }}
      variant="contained"
      color="Default"
    >
      + Study
    </Button>
  </div>
  <div>
    <Button
      style={{ width: "300px", padding: "60px", margin: "15px" }}
      variant="contained"
      color="Default"
    >
      All Studies
    </Button>
  </div>
  <div>
    <Button
      style={{ width: "300px", padding: "60px", margin: "15px" }}
      variant="contained"
      color="Default"
    >
      Planning
    </Button>
  </div>
</div>
<div>
  <div>
    <Button
      style={{ width: "300px", padding: "60px", margin: "15px" }}
      variant="contained"
      color="Default"
    >
      Platform
    </Button>
  </div>
  <div>
    <Button
      style={{ width: "300px", padding: "60px", margin: "15px" }}
      variant="contained"
      color="Default"
    >
      Products
    </Button>
  </div>
  <div>
    <Button
      style={{ width: "300px", padding: "60px", margin: "15px" }}
      variant="contained"
      color="Default"
    >
      Clients
    </Button>
  </div>
</div>

Alternatively, you can utilize the Grid component from MaterialUi to organize your content:

<div className={classes.root}>
    <Grid container spacing={3} direction="row" justify="center" alignItems="center">
      <Grid item>
        <Button
          style={{ width: "300px", padding: "60px", margin: "15px" }}
          variant="contained"
          color="Default"
        >
          + Study
        </Button>
      </Grid>
      <Grid item>
        <Button
          style={{ width: "300px", padding: "60px", margin: "15px" }}
          variant="contained"
          color="Default"
        >
          All Studies
        </Button>
      </Grid>
      <Grid item>
        <Button
          style={{ width: "300px", padding: "60px", margin: "15px" }}
          variant="contained"
          color="Default"
        >
          Planning
        </Button>
      </Grid>
    </Grid>
    <Grid container spacing={3}>
      <Grid item>
        <Button
          style={{ width: "300px", padding: "60px", margin: "15px" }}
          variant="contained"
          color="Default"
        >
          Platform
        </Button>
      </Grid>
      <Grid item>
        <Button
          style={{ width: "300px", padding: "60px", margin: "15px" }}
          variant="contained"
          color="Default"
        >
          Products
        </Button>
      </Grid>
      <Grid item>
        <Button
          style={{ width: "300px", padding: "60px", margin: "15px" }}
          variant="contained"
          color="Default"
        >
          Clients
        </Button>
      </Grid>
    </Grid>
  </div>

For more information, visit this link.

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

Sliding background in a multi-column accordion

I've hit a roadblock with this project. I'm working on setting up a FAQ section that needs to display its items in two columns on desktop, each with a drop shadow effect using Bootstrap 4. I've experimented with Flexbox and CSS columns with ...

What is the most efficient way to display a dynamic alphabetical order list?

sample code: <table width="100%" cellspacing="0" cellpadding="0" border="0" style="line-height: 1.7;"> <tbody> <?php $this->db->select('*'); $this->db->from('cm_options'); ...

Modifying CSS property values by handling a returned validation error

Allow me to describe a scenario I've created. Please excuse any language errors in my explanation. I have designed a form for users to submit values. Within this form, users can choose an option - one of which is "Others specify...". When this option ...

Utilizing spans to adjust the formatting of text within list items

When it comes to shaping text inside li elements, I've encountered a few issues. One of the problems is that the float-right divs aren't floating to the top right corner but instead leaving a space at the top. Additionally, the text isn't &a ...

Why is my client program not receiving a response from this socket.io server?

Currently, I am in the process of developing a trivia game where two users engage in answering questions with the winner being declared at the end. As part of this project, I have integrated socket.io to facilitate the exchange of answers. However, I have ...

Unexpected Error with Background Position Variable

Hello, I am attempting to create an animated background effect that moves up and down using the .animate() and .hover() methods in jQuery. Within my DOM, there is a div with id="#menu" containing a UL list where each item has a background positioned at dif ...

What is the best way to ensure a div container fills the entire height of the screen?

I am currently working on developing my very first iOS HTML5 app, which is a simple quote application. One challenge I am facing is how to set the height of my container div to match that of an iPhone screen. You can view the design I have so far on this j ...

Transform your traditional sidebar into a sleek icon sidebar with Semantic UI

I am working on customizing the semantic-ui sidebar. My goal is to have it minimize to a labeled icon when the toggle button is clicked. However, I am having trouble with the animation and getting the content to be pulled when I minimize it to the labeled ...

Issue with Material-ui Autocomplete: onChange event not firing when value is updated in onHighlightChange

I have been customizing Material UI's Autocomplete by adding a feature that allows users to move options to the input using keyboard events (Arrow keys up and down). Then, the user should be able to select an option by pressing the ENTER key. I am fa ...

One crucial factor to consider when dealing with dual screen setups is the

Imagine you have the following code snippet : <ul> <li>Menu1 <ul class="submenu"> <li class="firstmenu">submenu-1</li> <li>submenu-2</li> < ...

Arrange two divs on either side of the center div when on a smaller screen

Looking for a straightforward approach to achieve this. Imagine it as follows: [A][__B_][A] to [A][A] [__B_] I hope that explanation is clear, but I'm happy to provide more details if necessary. Thank you in advance! ...

Looking to fill every space? Try using React with MUI Grid!

I am currently using Material UI Grid to create an image grid, and I am facing challenges in eliminating the gaps between certain grid items. Despite attempting to modify the alignitems and justify values of the container, I have not been successful in r ...

Style sheets for two dynamically-sized boxes side by side

There are two boxes or columns positioned on the same line. Both have varying widths that need to remain on the same row. To clarify: .----------container 570px-----------. |[box1] [box2]| Ideal scenario | ...

What is the best way to use JavaScript to conceal a section of a form div?

After receiving some code from a certain platform and implementing it to hide part of my form div element, I noticed that the element hides and unhides quickly when running in a browser. This rapid hiding and showing behavior occurs when clicking on the bu ...

Eliminate borders surrounding WordPress text widgets

Looking for some help with removing the border around the widgets on my home page. Despite my theme's CSS removing borders universally, I thought targeting specific Div text widgets (such as text-7, text-6) would do the trick. While I can control the ...

Align content vertically within a div container

I have encountered an issue where I am trying to center vertically the content within a div. Here is an example of the structure: <div class="container-fluid"> <div class="row restaurant"> <div class="col-md-6"> & ...

When hovering over the menu, the sub-menu is displayed and the content slides downwards. Is there a way to prevent the content from sliding down and have the sub-menu overlap the

When the main menu is hovered over, a sub-menu appears and the content below the main menu slides down. Check out the code snippet below: HTML: <div id="holderDiv"> <div id="menu"> <a href="#" id="items">Menu 1</a> < ...

Arrangement of tables using HTML and CSS on the outdoor patio

Looking for advice on how to align buttons in the last column of a table outside of the table but in the same row. The attached image shows the current layout: https://i.sstatic.net/Ex5AR.png ...

Tips for inserting PHP information into the <link rel="stylesheet" type="text/css" href="CSS/sheet.css" /> reference tag

In my script, I have successfully implemented a feature that displays the OS and browser details. The output is in the form of eight CSS scripts, showcasing Mac, PC, and Ubuntu OS's with IE, Firefox, Safari, and Chrome browsers. While the script is st ...

`What specific type should be assigned to the custom styled input component in MUI?`

Hey team! Would you mind helping me out with this issue? The Mui documentation suggests setting a type for a Mui Styled component like this: const MyComponent = styled(MuiComponent)(({ theme }) => ({ // styling })) as typeof MuiComponent This method ...