@corpusctl/vue
v0.2.0
Published
Vue 3 renderer for Corpusctl headless CMS block content — zero default styling, every block type overridable
Maintainers
Readme
@corpusctl/vue
Vue 3 renderer for Corpusctl block content. A thin
adapter over the framework-agnostic render tree from @corpusctl/client —
the tree does the hard work (list nesting, mark nesting, heading anchors),
this package only draws it.
- Zero default styling — not a single
classin the default output. Every block type is overridable. - Unknown block types never crash the page; without a
types/fallbackmatch they are skipped gracefully.
Install
pnpm add @corpusctl/vuePeer dependency: vue >= 3.4.
Usage
<script setup>
import { h } from 'vue'
import { Content } from '@corpusctl/vue'
const components = {
paragraph: (n, render) => h('p', { class: 'prose' }, render(n.children)),
types: {
gallery: (n) => h(Gallery, { images: n.value.images }),
},
}
</script>
<template>
<Content :value="doc.fields.body" :components="components" :heading-anchors="true" />
</template>If you build the tree yourself, renderNodes(nodes, components, { headingAnchors })
is also exported.
The React adapter (@corpusctl/react) consumes the same tree and produces the
same default output — switching frameworks does not change the rendering
(pinned by tests).
License
MIT
