[autocomplete] Support full slots for clearIndicator and popupIndicator#47891
Conversation
Netlify deploy previewhttps://deploy-preview-47891--material-ui.netlify.app/ Bundle size report
|
There was a problem hiding this comment.
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()soslotProps.*callbacks are resolved withownerState. - Adds support for
slots.clearIndicatorandslots.popupIndicatorin the component implementation. - Updates the API docs JSON to reflect the expanded
slotsshape.
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.
|
nit, please add slot test to https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Autocomplete/Autocomplete.test.js#L62 |
|
@siriwatknp isn't there a test at ? |
@silviuaavram You need to update it to: This will test out that Also, I verified with this PR build that it works: https://stackblitz.com/edit/github-ocec1x59-1tgzcoaw?file=src%2FApp.tsx 👍 |
fb6b6a7 to
987c247
Compare
|
Cherry-pick PRs will be created targeting branches: v7.x |
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