2

How do I align one button to the left while the other two on the center?

Pls check codesandbox here CLICK HERE

    <DialogActions sx={{ justifyContent: "center" }}>
      <Button>Left</Button>
      <Button onClick={handleClose}>Cancel center</Button>
      <Button onClick={handleClose}>Subscribe center</Button>
    </DialogActions>

1 Answer 1

1

You can achieve that using Grid. Check out below codes.

<DialogActions
  sx={{
    display: "grid",
    gridTemplateColumns: "1fr repeat(2, auto) 1fr",
    justifyContent: "center"
  }}
>
  <Button sx={{ marginRight: "auto" }}>Left</Button>
  <Button onClick={handleClose}>Cancel center</Button>
  <Button onClick={handleClose}>Subscribe center</Button>
</DialogActions>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.