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

[pickers] Handle TextField slots with @mui/material@6 #14284

Open
LukasTy opened this issue Aug 21, 2024 · 3 comments
Open

[pickers] Handle TextField slots with @mui/material@6 #14284

LukasTy opened this issue Aug 21, 2024 · 3 comments
Assignees
Labels
component: pickers This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material

Comments

@LukasTy
Copy link
Member

LukasTy commented Aug 21, 2024

After #14142 when using @mui/material@6 it will be possible to pass:

slotProps={{
  textField: {
    slotProps: {
      input: { /* some props */ }
    }
  }
}}

But they will be ignored until further changes.

The adoption of slots is slightly complex because we clearly don't want to use or have a select slot available and also need to adapt the changes for the PickersTextField component.

Related @mui/material PR: mui/material-ui#42062.

Search keywords:

@LukasTy LukasTy added component: pickers This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material labels Aug 21, 2024
@LukasTy LukasTy self-assigned this Aug 21, 2024
@heath-freenome
Copy link

heath-freenome commented Sep 30, 2024

From #14745

We can't use the new slotProps as long as we support older versions of @mui/material.
Except if we have a way to distinguish between the two @mui/material version, but this would increase the typing complexity of some of our hooks and I'm not sure it's worth it.

Would adding a useSlotProps?: boolean flag that causes the components to pass things via slotProps be a good workaround for supporting one behavior (MUI6) vs the other (MUI5)

@flaviendelangle
Copy link
Member

It could be tricky to have good TypeScript support if we introduce these kind of conditionally available props.

@kallebornemark
Copy link

Is the TS error that can be seen on this CSB related to this issue, or is it something else?

When I wrap a TimeFIeld component in styled, the type for slotProps becomes way more narrow, so e.g. input is no longer part of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material
Projects
None yet
Development

No branches or pull requests

4 participants