使用Material-UI库时,如何向<Button>
和添加html属性<ButtonBase>
?例如,能够在按钮上将tabindex设置为-1。
我看到的组件,如<TextField>
可以使用InputProps,但似乎并没有像上任何道具<Button>
和<ButtonBase>
。
我在此处创建了功能请求(问题9585),但被告知可以这样做。
谢谢!
就像在文档中说的那样:“提供的任何其他属性都将传播到根元素。”
对于Button
,那就是ButtonBase
,对于ButtonBase
它来说button
(默认情况下,您可以使用component
prop覆盖)。因此:tabIndex
提供至Button
将应用于ButtonBase
,然后将其应用于button
。
在这种情况下tabIndex
,您还可以设置disabled
道具tabIndex={-1}
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句