Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stack] Allows clearing of margin-left property of child items. #42633

Closed
SageJustus opened this issue Jun 13, 2024 · 2 comments
Closed

[Stack] Allows clearing of margin-left property of child items. #42633

SageJustus opened this issue Jun 13, 2024 · 2 comments
Assignees
Labels
component: Stack The React component. support: question Community support but can be turned into an improvement

Comments

@SageJustus
Copy link

SageJustus commented Jun 13, 2024

Summary

Allows clearing of margin-left of child items.

Stack adds margin-left to its children, which does not work as expected when line wrapping is allowed.

Examples

https://codesandbox.io/p/sandbox/mui-1-hv4ls6?file=%2Fsrc%2FDemo.tsx

Motivation

Fix alignment issues in wrapping situations.

Search keywords: stack margin

@SageJustus SageJustus added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 13, 2024
@zannager zannager added the component: Stack The React component. label Jun 13, 2024
@siriwatknp
Copy link
Member

You can switch to gap implementation.

I recommend doing it at the theme level:

import { ThemeProvider, createTheme } from '@mui/material/styles';
import Stack from '@mui/material/Stack';

const theme = createTheme({
  components: {
    MuiStack: {
      defaultProps: {
        useFlexGap: true,
      },
    },
  },
});

function App() {
  return (
    <ThemeProvider theme={theme}>
      <Stack></Stack> {/* uses flexbox gap by default */}
    </ThemeProvider>
  );
}

@siriwatknp siriwatknp added support: question Community support but can be turned into an improvement and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 28, 2024
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

We value your feedback @SageJustus! How was your experience with our support team?
If you could spare a moment, we'd love to hear your thoughts in this brief Support Satisfaction survey. Your insights help us improve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Stack The React component. support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

3 participants