"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.

Essentially, my aim is to maintain this layout across all screens except for mobile devices. 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

Ways to implement a delay in a function?

I'm looking for a way to introduce a delay in my function. Should I enclose the function within a delay function, or is there a different method to ensure that the animation doesn't trigger until 5 seconds after the page has loaded? var textTo ...

manipulating dropdown visibility with javascript

I'm feeling a bit lost on how to structure this code. Here's what I need: I have 5 dropdown boxes, with the first one being constant and the rest hidden initially. Depending on the option chosen in the first dropdown, I want to display the corres ...

Arranging several lists in columns with a customized header title

I am looking to have 7 lists displayed side by side, each with a unique styled header title. I want the lists to be neatly organized under their respective titles, including the bullets. I attempted to use text-indent for this purpose, but it seems that ...

Ensuring Navigation Elements Remain Aligned in a Single Line

I'm in the process of developing an interactive project that will be showcased on a touch screen. One of its key features is a fixed footer navigation. Currently, I am using floats to position the main navigation elements and within each element, ther ...

Mastering the Art of Resizing Video Controls: A

https://i.stack.imgur.com/jTgap.png https://i.stack.imgur.com/Exf6Y.png On the initial screenshot, the video player displays normal controls. However, on the same website with identical CSS, the second video player shows different control settings. // C ...

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 ...

What is the method for displaying map tooltips by default rather than on mouseover?

Currently, I have a script set up to display a map with two markers. Whenever I hover over one of the markers, a popup tooltip appears with location information. My question is, how can I make the information appear by default without needing to hover ov ...

Convert a form into plain text utilizing CSS with minimal usage of jQuery or Javascript

I am working on an HTML page which has a form with various tags such as checkboxes, dropdowns, and more. When a button is clicked, I want to display the same form as plain text in a popup using jQuery dialog. Currently, I have managed to show the form in ...

Move divs that are currently not visible on the screen to a new position using CSS animations

Upon entering the site, I would like certain divs to animate from an offscreen position. I came across this code snippet: $( document ).ready(function() { $('.box-wrapper').each(function(index, element) { setTimeout(function(){ ...

Adjustments made to the size of the h1 font

I am perplexed by the fact that these two h1 tags have different font sizes, even though they have identical properties and declarations. From what little knowledge I have, it seems like it may be related to inheritance; considering one h1 tag is nested an ...

Parent whose height is less than that of the child element

I'm working on creating a side menu similar to the one on this website. However, I'm facing an issue with the height of the #parent list element. I want it to match the exact same height as its content (the #child span - check out this jsfiddle). ...

Updating typography on button click is a simple task that can be achieved by following

Using Material UI Typography, I want to update the text from (ABC) to (XYZ) when a button is clicked. Below you will find the relevant code snippet: function handleDrawerOpen() { setOpen(true); //update ABC to XYZ } function handleDrawerClose() { setOp ...

Animating content to slide into view in the same direction using CSS transitions

My goal is to smoothly slide one of two 'pages', represented as <divs>, into view with a gentle transition that allows the user to see one page sliding out while the other slides in. Eventually, this transition will be triggered from the ba ...

Elegant CSS background image fade effect

Having a small JS script that functions properly, but encountering an issue when quickly hovering over buttons causing the smooth transition effect to not work as desired. This abrupt change in image is quite unappealing. Any help would be greatly appreci ...

Javascript's second element does not trigger a click event with similar behavior

I'm currently facing an issue with displaying and hiding notification elements based on user interaction. My goal is to have multiple popup elements appear when the page loads. Then, when a user clicks the ".alert-close" element within one of the popu ...

Is there a way to eliminate the Button hover color in Mui?

I'm struggling to disable the hover color on my button. The inline style I tried isn't working as expected. const ButtonWrapper = styled(Box)` display: flex; margin: 0 3% 0 auto; & > button, & > p, & > div { mar ...

Change the CSS property to override the text-overflow with ellipsis

In my specific scenario, I need to override the default ellipsis behavior that adds '...' to text when using 'text-overflow: ellipsis', and instead use two stars **. Is there a way to achieve this using only Pure CSS? It is important t ...

What is the process for setting up a bootstrap grid with a single column at the top and two columns

Can anyone help me figure out how to rearrange a bootstrap grid from three columns on desktop to one column above and two below on mobile? I've attempted multiple methods, but haven't had any luck... https://i.stack.imgur.com/oY2VU.png ...

How can I align an image and text alongside another image using HTML and CSS?

Having some trouble positioning an Image and Text next to another Image. Check out an example here: I attempted using floats, but it doesn't seem to be working. Here is the code I have: .left {float: left;} .right{float: right;} <div class="left ...

What is the best way to apply CSS styles to a child div element in Next.js?

I'm currently working on enhancing the menu bar for a website project. Utilizing nextjs for my application I am aiming to customize the look of the anchor tag, however, encountering some issues with it not rendering correctly. Here is a snippet of ...