如何更改 Fluent ui TextField 的输入文本颜色?
我只是想将输入文本颜色更改为另一种颜色。 组件示例是:
<TextField
styles={{
fieldGroup: {
borderRadius: 0,
border: '0px solid transparent',
background: '#F3F2F1',
},
input : {
color: '#FF0000',
}
}}
placeholder="---------Text----------"
/>
我尝试在 IStyle 对象的描述、errorMessage、字段、fieldGroup、图标、前缀、后缀、根、subComponentStyles 和包装器属性上设置颜色属性,但它不起作用。
I simply want to change the input text color to another one.
Component example is:
<TextField
styles={{
fieldGroup: {
borderRadius: 0,
border: '0px solid transparent',
background: '#F3F2F1',
},
input : {
color: '#FF0000',
}
}}
placeholder="---------Text----------"
/>
I have tried to set the color property on description, errorMessage, field, fieldGroup, icon, prefix, suffix, root, subComponentStyles, and wrapper properties of the IStyle object, but it doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在代码中进行以下更改。在样式内部,使用
field
属性代替input
来更改输入文本的 CSS。像这样:您提到您已经尝试使用
field
属性,但它不起作用。我相信一定还有其他原因。您可以在下面的 codepen url 中查看完整的工作代码。您的代码中可能还缺少其他内容(如果是这样,请分享更多信息)。希望有帮助。codepen 上的完整工作代码 - https://codepen.io/AnkitSaxena2605/pen/LYepGxp
You need to do the following change in your code. Inside styles, instead of
input
usefield
property to change css for input text. Like this:You metioned that you already tried using the
field
property but it didn't work. I believe there must be some other reason for that. You can see the full working code in the below codepen url. May be there's something else missing in your code (if so please share more info) . Hope it helps.Full working code at codepen - https://codepen.io/AnkitSaxena2605/pen/LYepGxp