最佳答案
您可以像this Codepen example 中那样通过实现您自己的样式函数来设置组件的最大宽度属性。 .
const getStyles = () => {
return {
root: {
maxWidth: '100px'
}
}
};
<TextField
id='myTextField'
spellcheck={ false }
name='bar'
placeholder='Placeholder text'
defaultValue='Default text'
styles={ getStyles }
/>
有关此方法的更多文档可以在 https://github.com/OfficeDev/office-ui-fabric-react/wiki/Component-Styling#styles-prop 找到.
关于office-ui-fabric - 设置 Office UI Fabric TextField 的最大宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51904168/