Currently there is a logic in the Text component to decide what html component to be rendered.
So it can render div, span, a.
On a website a text can have role title, subtitle, paragraph etc.
Idea: Extend TextProps so include a new property preferredHTMLElement. Then if the Text will be used as title on a page it can get H1, H2 etc. That could help to boost SEO.
Alternative solution: use data attribute, e.g data-html-element (CON: can't limit the possible values)
Usage example:
<View>
<Text preferredHTMLElement="h1">I am the title</Text>
<Text preferredHTMLElement="h2">I am the sub-title</Text>
<Text preferredHTMLElement="p">I am just a paragraph</Text>
</View>
Is there an existing request?
Describe the feature request
Currently there is a logic in the
Text
component to decide what html component to be rendered. So it can render div, span, a.On a website a text can have role title, subtitle, paragraph etc.
Idea: Extend
TextProps
so include a new propertypreferredHTMLElement
. Then if the Text will be used as title on a page it can get H1, H2 etc. That could help to boost SEO.Alternative solution: use data attribute, e.g
data-html-element
(CON: can't limit the possible values)Usage example: