next.js 如何在版本5中右对齐Mui文本字段文本?

rbl8hiat  于 2023-05-28  发布在  其他
关注(0)|答案(1)|浏览(158)

我正试图右对齐的占位符文本在Mui v5。sx不能工作,我不知道如何使用'styled' x1c 0d1x
在我尝试了inputProps={{ style:{ textAlign:'right' }}}它被设置为元素但未在ui中更改(占位符文本大多数位于textField框的右侧)

ulmd4ohb

ulmd4ohb1#

你可以用inputProps来实现:

<TextField
    placeholder="your placeholder"
    inputProps={{
      sx: {
        textAlign: "right",
        "&::placeholder": {
          textAlign: "right",
        },
      },
    }}
  />

相关问题