Notes
The code on this page is React’s. How Vue writes it
| React | Vue | |
|---|---|---|
| Classes | className="p-4" | class="p-4" |
| Props | headerRows={1} | :header-rows="1" or :headerRows="1" |
A prop that is true | hyphenate | hyphenate |
| Content per page | render={({ pageNumber }) => …} | <template #render="{ pageNumber, totalPages }">…</template> |
| The page, deeper down | usePage() | usePage() (it injects the page) |
| What to render | <Invoice invoice={invoice} /> | h(Invoice, { invoice }) |
A template for generate | Template: ComponentType<{ data }> | Template: a component with the prop data |
The rest, and Vue’s own API, is in the Vue guide.
The code on this page is React’s. How Svelte writes it
| React | Svelte | |
|---|---|---|
| Classes | className="p-4" | class="p-4" (a list or an object of flags too) |
| Content per page | render={({ pageNumber }) => …} | {#snippet render(page)}{page.pageNumber}{/snippet} inside the Text or View |
| The page, deeper down | usePage() | usePage(), while the component is created |
| What to render | <Invoice invoice={invoice} /> | { component: Invoice, props: { invoice } } |
A template for generate | Template: ComponentType<{ data }> | Template: a component with the prop data |
The rest, and Svelte’s own API, is in the Svelte guide.
The code on this page is React’s. How Angular writes it
| React | Angular | |
|---|---|---|
| Components | <View>, <Path>, <TextField> | <ink-view>, <ink-path>, <ink-text-field>: ink- and the name in kebab case |
| Classes | className="p-4" | class="p-4", [class]="…" |
| Props | headerRows={1}, size="A4" | [headerRows]="1", size="A4" (an attribute is a string: bind numbers) |
A prop that is true | hyphenate | hyphenate |
| Style | style={{ padding: 20 }} | [style]="{ padding: 20 }"; [inkStyle] for @media blocks and lists of styles |
| Content per page | render={({ pageNumber }) => …} | [render]="footer" with <ng-template #footer let-page>{{ page.pageNumber }}</ng-template> |
| The page, deeper down | usePage() | injectPage() |
| What to render | <Invoice invoice={invoice} /> | { component: Invoice, inputs: { invoice } } |
A template for generate | Template: ComponentType<{ data }> | Template: a component with the input data |
The rest, and Angular’s own API, is in the Angular guide.
<Note author="Ana">Check the totals against the ledger.</Note>
<Note className="absolute right-0 top-0 bg-blue-500" open>Draft: not for circulation.</Note>
<Text>Total: 1,250<Note author="Ana">Includes the March refund.</Note> due on 1 May.</Text>
A Note is a text annotation: a sticky-note icon that viewers open to show its text, which is
its children (strings and numbers only). author is shown as its title, open shows the text
when the document opens, and its backgroundColor (or a bg-* class) is its colour, yellow by
default. icon picks the icon: 'note' (the default), 'comment', 'key', 'help',
'newParagraph', 'paragraph' or 'insert'. It takes no space: the icon, 20 pt square at any zoom, sits at the top-left corner of
its box, so a note placed before a paragraph in a row marks it, and position: 'absolute' with
insets puts it anywhere. It is on the page where its box starts; in a Header, a Footer or a
fixed element it is on every page. Under a transform, the icon stays upright and the same
size: only its corner moves. The icon is drawn into the PDF, so it prints and looks the same in
every viewer, and the output stays PDF/A-2b.
Inside a Text, a note is part of the line: it takes no room, and its icon hangs from the top of
the line where it is, on the page of that line. Line breaking keeps it with the word before it,
or after a space, with the word after it. There it takes backgroundColor and no other style.
Synced from packages/react/GUIDE.md in the inkoxide repository.