Skip to content

[autocomplete] Support full slots for clearIndicator and popupIndicator#47891

Merged
silviuaavram merged 6 commits into
mui:masterfrom
silviuaavram:fix/autocomplete-slot-props
Mar 5, 2026
Merged

[autocomplete] Support full slots for clearIndicator and popupIndicator#47891
silviuaavram merged 6 commits into
mui:masterfrom
silviuaavram:fix/autocomplete-slot-props

Conversation

@silviuaavram

@silviuaavram silviuaavram commented Mar 2, 2026

Copy link
Copy Markdown
Member

Fully support slotProps and slots for clear indicator and popup indicator.

Closes #47865.


Before: https://stackblitz.com/edit/github-ocec1x59?file=src%2FApp.tsx
After: https://stackblitz.com/edit/github-ocec1x59-1tgzcoaw?file=src%2FApp.tsx

Copilot AI review requested due to automatic review settings March 2, 2026 14:00
@silviuaavram silviuaavram added scope: autocomplete Changes related to the autocomplete. This includes ComboBox. v7.x needs cherry-pick The PR should be cherry-picked to master after merge. component: Autocomplete The React component. labels Mar 2, 2026
@mui-bot

mui-bot commented Mar 2, 2026

Copy link
Copy Markdown

Netlify deploy preview

https://deploy-preview-47891--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+142B(+0.03%) 🔺+11B(+0.01%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 987c247

@silviuaavram silviuaavram removed the component: Autocomplete The React component. label Mar 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends Autocomplete’s slot customization so clearIndicator and popupIndicator fully support both slots and callback slotProps (i.e. (ownerState) => props), addressing #47865.

Changes:

  • Refactors clear/popup indicator rendering to use useSlot() so slotProps.* callbacks are resolved with ownerState.
  • Adds support for slots.clearIndicator and slots.popupIndicator in the component implementation.
  • Updates the API docs JSON to reflect the expanded slots shape.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

File Description
packages/mui-material/src/Autocomplete/Autocomplete.js Switches clear/popup indicators to useSlot() so both slots and callback slotProps work.
docs/pages/material-ui/api/autocomplete.json Updates the documented slots prop type description to include the new slots.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/mui-material/src/Autocomplete/Autocomplete.js
Comment thread packages/mui-material/src/Autocomplete/Autocomplete.js
Comment thread packages/mui-material/src/Autocomplete/Autocomplete.js
Comment thread packages/mui-material/src/Autocomplete/Autocomplete.js
@siriwatknp

Copy link
Copy Markdown
Member

@silviuaavram

Copy link
Copy Markdown
Member Author

@siriwatknp isn't there a test at

?

@ZeeshanTamboli ZeeshanTamboli added the type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. label Mar 3, 2026
@ZeeshanTamboli

ZeeshanTamboli commented Mar 3, 2026

Copy link
Copy Markdown
Member

@siriwatknp isn't there a test at

?

@silviuaavram You need to update it to:

    only: [
      'slotsProp',
      'slotPropsProp',
      'slotPropsCallback',
      'slotPropsCallbackWithPropsAsOwnerState',
    ],

This will test out that slotProps.popupIndicator/slotProps.clearIndicator can be passed as callbacks and also slots pattern will be tested out. Currently it was only testing slotProps with object pattern. You can take a look at this file: https://github.com/mui/mui-public/blob/master/packages/test-utils/src/describeConformance.tsx for the test cases it runs.


Also, I verified with this PR build that it works: https://stackblitz.com/edit/github-ocec1x59-1tgzcoaw?file=src%2FApp.tsx 👍

Comment thread packages/mui-material/src/Autocomplete/Autocomplete.d.ts Outdated
@GerardasB GerardasB mentioned this pull request Mar 4, 2026
1 task
@silviuaavram silviuaavram force-pushed the fix/autocomplete-slot-props branch from fb6b6a7 to 987c247 Compare March 5, 2026 08:19

@ZeeshanTamboli ZeeshanTamboli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@silviuaavram silviuaavram merged commit e096f98 into mui:master Mar 5, 2026
22 checks passed
@silviuaavram silviuaavram deleted the fix/autocomplete-slot-props branch March 5, 2026 09:14
@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

Cherry-pick PRs will be created targeting branches: v7.x

@oliviertassinari oliviertassinari changed the title [Autocomplete] Support full slots for clearIndicator and popupIndicator [autocomplete] Support full slots for clearIndicator and popupIndicator Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs cherry-pick The PR should be cherry-picked to master after merge. scope: autocomplete Changes related to the autocomplete. This includes ComboBox. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. v7.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[autocomplete] slotProps.popupIndicator does not accept a function returning props

5 participants