Summary
Add a codemod that migrates the common MUI FormControl + InputLabel + Select + MenuItem pattern to the BUI Select API.
This is a structural form migration rather than a simple import swap. The codemod should target the straightforward single-select cases first and use TODO markers for more semantic variants such as grouped or multi-select options.
Detection Criteria
FormControl, InputLabel, Select, MenuItem, and optional FormHelperText imports from @material-ui/core
- inline
MenuItem children with static value props and text labels
- select
onChange handlers that read event.target.value
Transformation Logic
- Replace the MUI wrapper imports with
Select from @backstage/ui when the pattern is the standard single-select shape.
- Collapse the wrapper structure into a single
Select element with label, selectedKey, and onSelectionChange.
- Convert inline
MenuItem children into a BUI options array with id and label keys when each option is statically visible.
- Rewrite the common
onChange={e => setValue(e.target.value as string)} shape to onSelectionChange={key => setValue(key as string)}.
- Leave
TODO(backstage-codemod): finish Select migration manually when the source uses multiple, grouped options, helper text, or nontrivial option rendering.
Before / After Example
Basic single select:
// Before
<FormControl fullWidth>
<InputLabel>Framework</InputLabel>
<Select value={value} onChange={e => setValue(e.target.value as string)}>
<MenuItem value="react">React</MenuItem>
<MenuItem value="angular">Angular</MenuItem>
</Select>
</FormControl>
// After
<Select
label="Framework"
selectedKey={value}
onSelectionChange={key => setValue(key as string)}
options={[
{ id: 'react', label: 'React' },
{ id: 'angular', label: 'Angular' },
]}
/>
Notes / Edge Cases
- This issue should stay separate from the
@backstage/ui v1.52 Select/Combobox deprecation codemod; the source components and destination APIs are different.
- Do not try to preserve arbitrary
MenuItem children markup in the deterministic pass.
- If helper text or validation UI matters to the migrated form, leave a TODO marker rather than dropping it silently.
- The migration skill treats Select as a first-class MUI to BUI family even though representative PR evidence is thinner than for alerts or buttons.
Changeset (when implementing)
- Package:
@backstage/migrate-mui-select-family-to-bui-select
- Bump: minor (initial release)
- Summary example:
Add codemod to migrate mui select family to bui select for the Backstage MUI 4 to BUI migration
Implementation notes
- Target directory:
codemods/misc/migrate-mui-select-family-to-bui-select/
- Branch/worktree:
.worktrees/feat/mui4-to-bui/migrate-mui-select-family-to-bui-select
- Open PR when ready; one PR per codemod
Summary
Add a codemod that migrates the common MUI
FormControl+InputLabel+Select+MenuItempattern to the BUISelectAPI.This is a structural form migration rather than a simple import swap. The codemod should target the straightforward single-select cases first and use TODO markers for more semantic variants such as grouped or multi-select options.
Detection Criteria
FormControl,InputLabel,Select,MenuItem, and optionalFormHelperTextimports from@material-ui/coreMenuItemchildren with staticvalueprops and text labelsonChangehandlers that readevent.target.valueTransformation Logic
Selectfrom@backstage/uiwhen the pattern is the standard single-select shape.Selectelement withlabel,selectedKey, andonSelectionChange.MenuItemchildren into a BUIoptionsarray withidandlabelkeys when each option is statically visible.onChange={e => setValue(e.target.value as string)}shape toonSelectionChange={key => setValue(key as string)}.TODO(backstage-codemod): finish Select migration manuallywhen the source usesmultiple, grouped options, helper text, or nontrivial option rendering.Before / After Example
Basic single select:
Notes / Edge Cases
@backstage/uiv1.52 Select/Combobox deprecation codemod; the source components and destination APIs are different.MenuItemchildren markup in the deterministic pass.Changeset (when implementing)
@backstage/migrate-mui-select-family-to-bui-selectAdd codemod to migrate mui select family to bui select for the Backstage MUI 4 to BUI migrationImplementation notes
codemods/misc/migrate-mui-select-family-to-bui-select/.worktrees/feat/mui4-to-bui/migrate-mui-select-family-to-bui-select