ComponentsLumos 0.0.1Open component
RichText
Styles a block of HTML you did not write: from a CMS, a Markdown file, or a form.
Content that arrives as a block of HTML (from a CMS, a Markdown file, an editor) has headings, lists, links and bold text in it that you cannot put classes on. RichText styles that block from the outside, so it matches the rest of the site without anyone having to tag it.
<RichText>
<Fragment set:html={post.body} />
</RichText>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
render | boolean | true | Set to false to skip this component and everything inside it. |
variant | "inherit" | "display" | "h1"–"h6" | "large" | "main" | "small" | "inherit" | The base text style for the block. Headings inside keep their own sizes. |
maxWidth | number | None | A maximum width in ch units for the whole block. |
What it styles
Headings take the site's type scale, lists get markers and spacing, links get the theme's link colors and underline, and the first and last children have their outer margins removed so the block sits flush in its container.