Components
Markdown
Render markdown strings with GFM tables, code and styled elements.
Installation
$ npx veil-ui@latest add markdownUsage
import { Markdown } from "@/components/ui/markdown";
<Markdown>{"## Title\n\nSome **bold** text."}</Markdown>;Examples
Basic
Release notes
Ship accessible components with npx veil-ui add.
- Copy the source
- Own the code
- Keep the styles
No wrapper library, no lock-in.
GFM
| Component | Status |
|---|---|
| Button | Stable |
| Markdown | New |
Legacy wrapper replaced by source files.
The component maps headings, lists, tables, quotes and code to the same
typographic scale used across the docs. Pass className to constrain measure,
for example max-w-prose.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| children | string | — | Markdown source to render. |
| className | string | — | Wrapper class; useful for max-width and spacing. |
Accessibility
- Renders semantic elements for headings, lists, tables and links, keeping the document outline intact.
- Tables must include a header row in the markdown source for proper associations.
- Raw HTML is not enabled, which removes a common injection vector.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add markdown --framework vue or switch the framework in components.json.
<script setup lang="ts">
import { computed } from "vue";
import { cn } from "@/lib/utils";
import { renderMarkdown } from "./render";
const props = defineProps<{
children?: string;
source?: string;
class?: string;
}>();
const html = computed(() => renderMarkdown(props.children ?? props.source ?? ""));
</script>
<template>
<div data-slot="markdown" :class="cn('text-sm', props.class)" v-html="html" />
</template>