【发布时间】:2021-03-02 09:48:52
【问题描述】:
我正在使用材质 UI 自动完成...当标签为长文本时,我想修剪它。
<Autocomplete
id="combo-box-demo"
options={top100Films}
getOptionLabel={(option) => option.title}
style={{ width: 300 }}
renderInput={(params) =>
<TextField {...params} label="This is very long
labellllllllllllllllllllllllllllllllllllllllllll" variant="outlined" />}
/>
【问题讨论】:
-
你可以在 css 中使用
text-overflow: ellipsis.MuiInputLabel-outlined.MuiInputLabel-shrink.. 工作示例:codesandbox.io/s/material-ui-autocomplete-forked-p4fd1
标签: javascript reactjs ecmascript-6 material-ui frontend