Skip to content
EspañolEnglish
All components (283)

Prose

Typography · Prose · .amset-prose

What it is and when to use it

Wrapper that styles raw HTML you do not write yourself: the body of an article, a legal page, the output of an editor or of Markdown.

When to use it

  • To render raw HTML (h1-h6, paragraphs, lists, quotes, links, code, tables, images, hr) without putting a class on every element.
  • size adjusts the size of all the prose at once (sm, md, lg, xl).

When not to

  • For text you write yourself in the interface: Text, Title and List give the same with more control.
  • For an editing area: the rich text editor goes there.

Keyboard: it does not take part. Links and controls inside behave as usual.

Accessibility: it respects the semantics of the HTML it receives. Links are underlined (color is not the only thing that distinguishes them) and headings do not change level. A wide table scrolls inside its own box, so it does not force the whole page to scroll horizontally.

Reading measure: it limits the width to 65 characters so it reads comfortably; fullWidth removes that. A block that must not inherit the style carries the class amset-not-prose.

Fine-tuning: --amset-prose-size, --amset-prose-measure, --amset-prose-flow and --amset-prose-leading.

What it looks like

import { Prose } from "@amset/ui";

<Prose size="md" fullWidth={false}>{null}</Prose>

Props

Import it with import { Prose } from '@amset/ui'. Required props are marked.

PropTypeWhat it does
childrenrequiredReactNodeHTML you do not control: what comes out of a content manager or from Markdown.
classNamestringMerged with the library classes; it does not replace them.
fullWidthbooleanRemoves the maximum reading measure (65 characters) for prose at full width.
size"sm" | "md" | "lg" | "xl"Size of the prose body; the headings and the rest of the blocks follow it.

It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.

CSS variables

These CSS variables are how you adapt it. Declare them on the component's selector, not on :root: the stylesheet redeclares them in the rule itself, and a declaration on the same element always wins.

VariableDefault
--amset-prose-size1rem
--amset-prose-measure65ch
--amset-prose-flow1.25em
--amset-prose-leadingvar(--amset-line-normal)

How to change it

.amset-prose {
  --amset-prose-size: ...;
  --amset-prose-measure: ...;
}

In the test bench

Every state and variant, to try one at a time, on its page at storybook.amsetui.com: