Rebass: On v2, `Text` component is a `div`

Created on 30 Jun 2018  路  4Comments  路  Source: rebassjs/rebass

screen shot 2018-07-01 at 01 41 48

It should be a paragraph, ain't it?

Most helpful comment

yes I know we can set it with is prop.
But isn't it better to set Text as p element by default? Like what we have on v1?

All 4 comments

You can set the HTML element with the is prop where appropriate, e.g. <Text is='p' />

yes I know we can set it with is prop.
But isn't it better to set Text as p element by default? Like what we have on v1?

@jxnblk What are the motivations behind making blocks of text a div by default? I think that using p for text is more frequent. Using <Text is="div" /> would still be possible.

Not all text on a page is a paragraph, so overusing the <p> tag can also not be great. The Text component can also be used as a wrapping component around other semantic elements, where you could have something like

<Text fontSize={3}>
  <p>...</p>
  <p>...</p>
  <ul>...</ul>
</Text>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

coreybruyere picture coreybruyere  路  5Comments

JaKXz picture JaKXz  路  4Comments

mrcoles picture mrcoles  路  4Comments

karland picture karland  路  7Comments

contra picture contra  路  5Comments