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] nested slot props not working in textfield #16230

Closed
FerhatAvdic opened this issue Jan 17, 2025 · 3 comments
Closed

[pickers] nested slot props not working in textfield #16230

FerhatAvdic opened this issue Jan 17, 2025 · 3 comments
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@FerhatAvdic
Copy link

FerhatAvdic commented Jan 17, 2025

Steps to reproduce

[Steps:

  1. Open this link to live example: (Codepen Link)
  2. Pass textfield slotprops via parent component into the datepicker component
  3. spread textfield slotprops into the slotprops: { textfield } prop
    ]

Current behavior

Nested slotProps are not applied to TextField in the DateTimePicker component.
Nested legacy props like inputProps etc. work, but are deprecated.

Expected behavior

The slotProps passed from parent to DateTimePicker, and used inside its slotProps: {textField: {slotProps }} should work.

Context

Im trying to modify behavior of the Textfield dynamically from a parent component.

Your environment

npx @mui/envinfo
  Firefox browser used.

    @emotion/react: ^11.11.4 => 11.14.0
    @emotion/styled: ^11.11.5 => 11.14.0
    @mui/core-downloads-tracker:  6.3.0
    @mui/material: ^6.3.0 => 6.3.0
    @mui/private-theming:  6.3.0
    @mui/styled-engine:  6.3.0
    @mui/system:  6.3.0
    @mui/types:  7.2.20
    @mui/utils:  6.3.0
    @mui/x-date-pickers: ^7.23.3 => 7.23.3
    @mui/x-internals:  7.23.0
    @types/react: ^19.0.2 => 19.0.2
    react: 19.0.0 => 19.0.0
    react-dom: 19.0.0 => 19.0.0
    typescript: ~5.6.2 => 5.6.3

Search keywords: nested slotprops, datepicker slotprops, slotprops, datetimepicker slotprops

@FerhatAvdic FerhatAvdic added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 17, 2025
@DiegoAndai DiegoAndai transferred this issue from mui/material-ui Jan 17, 2025
@michelengelen
Copy link
Member

Hey @FerhatAvdic ... thanks for opening this issue here.
We actually do use the InputProps in our useClearableField hook, so we need to switch to using slotProps before we can incorporate material-ui@v7.

@flaviendelangle is there already an issue handling this, or should we use this instead?

@michelengelen michelengelen added bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 20, 2025
@michelengelen michelengelen changed the title DatePicker/DateTimePicker nested slot props not working [pickers] nested slot props not working in textfield Jan 20, 2025
@flaviendelangle
Copy link
Member

We can use #14284

I think we will drop the usage of the Text Field component before supporting @mui/material@7 (see this doc section for context, which will become opt-out in our v8 and the only available structure in our v9).

So I'm not sure we will support the Text Field slots in the forseable future.

@LukasTy
Copy link
Member

LukasTy commented Jan 20, 2025

Thank you for creating this issue, but I'm closing it as a duplicate of #14284. 😉

@LukasTy LukasTy closed this as completed Jan 20, 2025
@LukasTy LukasTy added the duplicate This issue or pull request already exists label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants