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

[system] Official support for unstable_breakpoints-related functions #29864

Open
2 tasks done
Nicktho opened this issue Nov 24, 2021 · 1 comment
Open
2 tasks done

[system] Official support for unstable_breakpoints-related functions #29864

Nicktho opened this issue Nov 24, 2021 · 1 comment
Labels
new feature New feature or request package: system Specific to @mui/system

Comments

@Nicktho
Copy link

Nicktho commented Nov 24, 2021

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

Hello!

We've decided to go ahead and use @mui/system as a base to build our custom component library.

One feature in particular we love is the responsive features of system props, for example:

<Box sx={{ width: [100, 200] }} />
<Box sx={{ width: { xs: 100, sm: 200 } }} />

We would love to bring this functionality in our custom components built on top of the system, using breakpoints defined in the theme as well as the same API.

Upon investigation on how some @mui/material components are built, I can see some functions are imported from @mui/system to help accomplish this.

For example, to support the responsive direction prop on the Stack component, utilities such as handleBreakpoints and unstable_resolveBreakpointValues are used: https://github.com/mui-org/material-ui/blob/master/packages/mui-material/src/Stack/Stack.js#L47

Documentation and official support of using these exported utils from @mui/system would help us greatly, instead of building our own solution. The unstable_ prefix also worries me if we were to start using some of these utils now.

Examples 🌈

It would allow us to build custom components with responsive props that respect the breakpoints in the theme with ease.

<CoolGraph variant={{ mobile: 'bar', desktop: 'line' }} />

Motivation 🔦

Without official support of these utils and documentation, we would either:

  1. Need to dig into the typing and source to figure out how to use the exported utils.
  2. Risk depending on a potential future breaking change with any unstable_ prefixed exports.
  3. Build our own solution
@Nicktho Nicktho added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 24, 2021
@Nicktho Nicktho changed the title Official expose support for custom component props to use breakpoints via @mui/system Official support for custom component props to be responsive via @mui/system Nov 24, 2021
@hbjORbj hbjORbj added new feature New feature or request package: system Specific to @mui/system and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 24, 2021
@hbjORbj hbjORbj changed the title Official support for custom component props to be responsive via @mui/system Official support for unstable_breakpoints-related functions in @mui/system Nov 24, 2021
@mbrookes mbrookes changed the title Official support for unstable_breakpoints-related functions in @mui/system [system] Official support for unstable_breakpoints-related functions Nov 28, 2021
@mbrookes mbrookes changed the title [system] Official support for unstable_breakpoints-related functions [system] Official support for unstable_breakpoints-related functions Nov 28, 2021
@olee
Copy link
Contributor

olee commented Dec 20, 2021

I totally agree with this one and this is a major letdown that there's no way to use these utilities properly yet for building custom components.
If the functions were at least exported with their current "unstable_" prefix that would be one thing, however right now they are completely invisible to any typescript project which makes this even more cumbersome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request package: system Specific to @mui/system
Projects
None yet
Development

No branches or pull requests

3 participants