material -ui的Typography组件的有效值是多少 [英] What are the valid values for material -ui's Typography component

查看:182
本文介绍了material -ui的Typography组件的有效值是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用如下的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(这就是stylechildren属性在此示例中传递给组件的原因.)

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆