Bbackstage

backstage/migrate-mui-autocomplete-to-combobox

MUI 4 to BUI: Replace Autocomplete with BUI Combobox or SearchAutocomplete

backstagemigrationmuibuiautocompletecombobox
Public
0 executions

Run locally

npx codemod @backstage/migrate-mui-autocomplete-to-combobox

@backstage/migrate-mui-autocomplete-to-combobox

Heuristically migrates MUI 4 Autocomplete to Backstage UI Combobox or SearchAutocomplete.

Covers

  • Form-like option pickers with string[] literal optionsCombobox
  • Clear free-text search (onInputChange + word-boundary search/find/filter cue, no selection value) → SearchAutocomplete
  • Deep and barrel imports from @material-ui/lab
  • Best-effort option literal flattening for string arrays
  • Prunes unused TextField imports left behind by renderInput
  • Maps MUI size to BUI size (small preserved; medium/large/omitted → medium; falls back to static size on the renderInput TextField)

TODOs left for humans

  • Ambiguous Autocomplete usage (left as MUI with a TODO)
  • Object options / getOptionLabel shapes (not safe for BUI Combobox)
  • freeSolo, custom renderOption, and other complex cases
  • Non-trivial onChange / options shapes
  • Dynamic size on Autocomplete

Won't do

  • Perfect API parity for every Autocomplete prop

Ready to contribute?

Build your own codemod and share it with the community.