Skip to content

Prose ​

Typography for written content: article, help page, rendered Markdown or CMS content. Headings, paragraphs, lists, quotes, code, tables and images take the theme colors and spacing.

Usage ​

Component ​

vue
<SuProse as="article">
  <h2>Installing SurgeUI</h2>
  <p>The <code>@surgeui/vue</code> package provides the components, styles and types.</p>
  <ul>
    <li>Vue 3.5 or later</li>
    <li>A build tool that imports CSS</li>
  </ul>
</SuProse>

Class only (rendered HTML) ​

vue
<script setup>
import { marked } from 'marked'

const html = marked.parse(markdown)
</script>

<template>
  <article class="su-prose" v-html="html" />
</template>

v-html inserts HTML as is: keep it for trusted content, or sanitize it first (DOMPurify).

Sizes ​

vue
<SuProse size="sm">…</SuProse>
<SuProse size="lg">…</SuProse>

Heading, code and table sizes follow the text size (em units).

Styled elements ​

ElementRendering
h1 to h6Semibold, tight line height, larger top margin than bottom margin
p, lists, quotes, tablesEven vertical rhythm; no margin at the start or end of the content
aTheme link color, underlined, focus ring
ul, ol, liTertiary-colored bullets and numbers, nested lists
blockquoteLine at the start of the line (border-inline-start), secondary text
code, kbd, preMonospace font; pre scrolls horizontally and stays left to right
tableFull width, separated rows, emphasized header
img, video, figureContainer max width, rounded corners, secondary caption
hr, mark, smallThin separator, soft highlight, secondary text

Customization ​

Rules use :where(): their specificity is that of the .su-prose class alone, so a rule in your stylesheet overrides them without !important.

css
.su-prose h2 {
  color: var(--su-primary-default);
}

API ​

Props ​

PropTypeDefaultDescription
asstring'div'Rendered element (article, section…)
size'sm' | 'md' | 'lg''md'Text size

Slots ​

SlotDescription
defaultWritten content

Accessibility ​

  • Elements keep their meaning: the heading hierarchy stays the content's own.
  • Line length: limit the container width (60 to 75 characters, for example max-inline-size: 70ch).
  • Logical properties: quotes, lists and indents sit on the right side in RTL.
  • Links stay underlined: color is not the only cue.

Publié sous licence MIT.