Skip to content
Inkoxide

Search covers every page and heading of the docs. Use ↑ ↓ and ↵.

Templates

Edit this page

A template is a Vue component whose render gives a <Document>: a single-file component, a component with a render function (h), or JSX through @vitejs/plugin-vue-jsx. What it renders is not DOM: Inkoxide renders it with a renderer of its own, once, and reads the document from what the components made.

<script setup lang="ts">
import { Document, Page, Text } from '@inkoxide/vue';

defineProps<{ customer: string }>();
</script>

<template>
  <Document title="Receipt">
    <Page size="A6" class="p-8">
      <Text class="text-lg font-bold">Receipt for {{ customer }}</Text>
    </Page>
  </Document>
</template>

Any Vue feature that renders synchronously works: props, v-if, v-for, slots, provide and inject, computed values, components of your own. The white space of a template is read as JSX reads it, so a document gives the same tree, and the same PDF, in every front end.

Synced from packages/vue/GUIDE.md in the inkoxide repository.