material -ui的Typography组件的有效值是多少 [英] What are the valid values for material -ui's Typography component
问题描述
我正在使用如下的Typography组件.我没有遇到任何错误.但是我只想知道它是否是我要传递给版式组件的组件属性的正确值.
I am using Typography component as below. I am not facing any error. But i just want to know whether it is the right value i am passing to component property of typography component.
<Typography component="div" style={{ padding: 8 }}>
{props.children}
</Typography>
可以传递给组件属性的有效值是什么?
What are the valid values that can be passed to component property?
推荐答案
Typography is a fairly simple component. All it does is specify className
on the component such that the text is styled appropriately.
您的示例代码大致等同于:
Your sample code is roughly equivalent to:
<div className="potentially-multiple-classes-determined-by-Typography" style={{ padding: 8 }}>
{props.children}
</div>
component
属性可以是在JSX中可以用作元素类型的任何有效内容.印刷术将使用组件prop(如果未指定component
prop或variant
prop则默认为'p')呈现一个元素,该元素将类名传递给该元素,并且还将通过不属于该属性的任何属性Typography API(这就是style
和children
属性在此示例中传递给组件的原因.)
The component
prop can be anything that is valid to use as an element type in JSX. Typography will use the component prop (which defaults to 'p' if no component
prop or variant
prop is specified) to render an element that it passes class names to and it also passes through any properties that aren't part of the Typography API (which is why the style
and children
properties get passed through to the component in this example).
这篇关于material -ui的Typography组件的有效值是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!