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

[SKELETON] [BUG] Skeleton Height is Unpredictable(Ghost Padding or Margin) Without variant Attribute #42707

Closed
1 task done
realvandi opened this issue Jun 21, 2024 · 2 comments
Assignees
Labels
customization: css Design CSS customizability package: system Specific to @mui/system

Comments

@realvandi
Copy link

realvandi commented Jun 21, 2024

Search keywords

Skeleton, Height, Padding, Margin

Latest version

  • I have tested the latest version

Steps to reproduce

Done in a fresh NextJS project:

export default function Home() {
  return (
    <>
     <Box sx={{ display: "flex", flexDirection: "row", gap: 1 }}>
        <Box
          sx={{
            height: 400,
            width: "100%",
            padding: 1,
            backgroundColor: "#ff33b211",
          }}
        >
          <Skeleton height={"100%"} />
        </Box>
        <Box
          sx={{
            height: 400,
            width: "100%",
            padding: 1,
            backgroundColor: "#22ffb211",
          }}
        >
          <Skeleton variant="rounded" height={"100%"} />
        </Box>
      </Box>
      <code>{'<Skeleton height={"100%"}/>'}</code>
      <small>(left)</small>
      <Typography>vs.</Typography>
      <code>{'<Skeleton variant="rounded" height={"100%"}/>'}</code>
      <small>(right)</small>
      <Typography>
        Both skeletons are surrounded in
        <code>{'<Box sx={{ height: 400, width: "100%", padding: 1 }}>'}</code>
      </Typography> 
    </>
  );
}

Current behavior

Screenshot 2024-06-21 at 18 00 24
-TL;DR: Excluding the variant attribute makes the height of a skeleton component unexpected.

Expected behavior

-Including/excluding the variant attribute should not affect how the height of the skeleton grows.

Context

-Reproduced in a fresh NextJS project, using the latest versions of @mui/material and @mui/system available from NPM.

Your environment

  "dependencies": {
    "@emotion/react": "^11.11.4",
    "@emotion/styled": "^11.11.5",
    "@mui/material": "^5.15.20",
    "@mui/system": "^5.15.20",
    "next": "14.2.4",
    "react": "^18",
    "react-dom": "^18"
  }
@realvandi realvandi added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 21, 2024
@realvandi realvandi changed the title [SKELETON] Skeleton Height is Unpredictable(Ghost Padding or Margin) Without Variant Attribute [SKELETON] Skeleton Height is Unpredictable(Ghost Padding or Margin) Without variant Attribute Jun 21, 2024
@realvandi realvandi changed the title [SKELETON] Skeleton Height is Unpredictable(Ghost Padding or Margin) Without variant Attribute [SKELETON] [BUG] Skeleton Height is Unpredictable(Ghost Padding or Margin) Without variant Attribute Jun 21, 2024
@zannager zannager added package: system Specific to @mui/system customization: css Design CSS customizability labels Jun 24, 2024
@brijeshb42
Copy link
Contributor

If you don't specify a variant, the default is text which has it's own styling. From the docs:

represents a single line of text (you can adjust the height via font size).

@brijeshb42 brijeshb42 added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jun 26, 2024
@realvandi
Copy link
Author

Oops, you're right, thanks for pointing this out. I guess I missed that part of the documentation. Thanks for the response!

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Jun 29, 2024
@zannager zannager removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customization: css Design CSS customizability package: system Specific to @mui/system
Projects
None yet
Development

No branches or pull requests

3 participants