Skip to content

[system] Remove custom behavior for sx={{ width: 1 }} #38583

@oliviertassinari

Description

@oliviertassinari

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

https://mui.com/system/sizing/

<Box sx={{ width: 1 }} />

feels a bit like a foot gun. I would expect 1px, not 100%. This discussion started in https://github.com/mui/mui-x/pull/5177/files#r895041464.

Examples 🌈

I would propose:

diff --git a/packages/mui-system/src/sizing.js b/packages/mui-system/src/sizing.js
index 0454dfb170..c6c8920e49 100644
--- a/packages/mui-system/src/sizing.js
+++ b/packages/mui-system/src/sizing.js
@@ -3,7 +3,7 @@ import compose from './compose';
 import { handleBreakpoints, values as breakpointsValues } from './breakpoints';

 export function sizingTransform(value) {
-  return value <= 1 && value !== 0 ? `${value * 100}%` : value;
+  return value < 1 && value > 1 ? `${value * 100}%` : value;
 }

 export const width = style({

Motivation 🔦

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions