简体   繁体   English

MUI 文本字段标签未正确浮动到左上角

[英]MUI textfield label not floating to the top left properly

I try to use the MUI in my project, and all the input fields I use don't behave correctly.我尝试在我的项目中使用 MUI,但我使用的所有输入字段都无法正常工作。

it supposed to look like this它应该看起来像这样图片来自 MUI 网站

but when I use it it will look like this但是当我使用它时,它看起来像这样

在此处输入图像描述

import Box from '@mui/material/Box'
import TextField from '@mui/material/TextField'
import Autocomplete from '@mui/material/Autocomplete'

<Autocomplete
className="mt-3"
size="small"
id="country-select-demo"
options={arr}
autoHighlight
getOptionLabel={(option) => option.label}
renderOption={(props, option) => (
<Box
component="li"
sx={{ '& > img': { mr: 2, flexShrink: 0 } }}
{...props}
>
{option.label}
</Box>
)}
renderInput={(params) => (
<TextField
{...params}
label="Choose.."
inputProps={{
...params.inputProps,
}}
/>
)}

我刚刚发现卸载 react-bootstrap 可以解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM