Is there a way to ensure that long strings in an MUI Select component do not exceed the width and get cut off on mobile devices? How can I add a text-wrap or similar feature?
Desktop:
https://i.sstatic.net/lo8zM.png
Mobile:
https://i.sstatic.net/8xoW6.png
<FormControl sx={{ m: 1, minWidth: '100%', marginLeft: 0, padding: 0 }}>
<Select
value={prompt}
onChange={handleChange}
displayEmpty
inputProps={{ 'aria-label': 'Without label' }}
sx={{'bgcolor': 'rgba(139, 139, 139, 0.3)', color: 'white', border: '1px solid rgba(255, 255, 255, 0.4)', minWidth: '100%', marginLeft: 0, padding: 0}}
>
{prompts.map((prompt, i) => <MenuItem value={i}>{prompt}</MenuItem>)}
</Select>
prompt
is an array of strings.
What methods can be used to style the select menu? How can we prevent the dropdown width from exceeding the width of the Select
element?