What are the valid values for material -ui's Typography component

自作多情 提交于 2020-02-06 18:55:27

问题


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?


回答1:


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>

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).



来源:https://stackoverflow.com/questions/56705789/what-are-the-valid-values-for-material-uis-typography-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!