prestyled
Version:
React components for styling web projects, based upon Theme UI
28 lines (22 loc) • 1.13 kB
Markdown
### Heading (variant:'default')
Heading extends the [Heading](https://theme-ui.com/components/heading) provided by Theme UI.
A heading can be styled independently of the H-level used in the resulting markup.
- A default heading without props will be rendered as a <H2> and styled as `h2` variant.
- Setting `as="h3"` results in a <H3> markup and a `h3` variant styling accordingly.
- Setting `as="h3"` in combination with `variant="h2"` will result in <H3> markup and `h2` variant styling.
- `variant` trumps `as` prop in it's effect on preset style.
```js
<Heading>A Heading renders by default as <H2></Heading>
```
### Variants of Headings
```js
<Heading as="h1"><H1> Heading</Heading>
<Heading as="h2"><H2> Heading</Heading>
<Heading as="h3"><H3> Heading</Heading>
<Heading as="h4"><H4> Heading</Heading>
<Heading as="h5"><H5> Heading</Heading>
<Heading as="h6"><H6> Heading</Heading>
<br />
<Heading variant="h6" as="h1">A <H1> Heading rendered with h6 variant</Heading>
<Heading variant="h1" as="h6">A <H6> Heading rendered with h1 variant</Heading>
```