Skip to content
Inkoxide

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

Styling

Edit this page

The code on this page is React’s. How Vue writes it
ReactVue
ClassesclassName="p-4"class="p-4"
PropsheaderRows={1}:header-rows="1" or :headerRows="1"
A prop that is truehyphenatehyphenate
Content per pagerender={({ pageNumber }) => …}<template #render="{ pageNumber, totalPages }">…</template>
The page, deeper downusePage()usePage() (it injects the page)
What to render<Invoice invoice={invoice} />h(Invoice, { invoice })
A template for generateTemplate: 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
ReactSvelte
ClassesclassName="p-4"class="p-4" (a list or an object of flags too)
Content per pagerender={({ pageNumber }) => …}{#snippet render(page)}{page.pageNumber}{/snippet} inside the Text or View
The page, deeper downusePage()usePage(), while the component is created
What to render<Invoice invoice={invoice} />{ component: Invoice, props: { invoice } }
A template for generateTemplate: 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
ReactAngular
Components<View>, <Path>, <TextField><ink-view>, <ink-path>, <ink-text-field>: ink- and the name in kebab case
ClassesclassName="p-4"class="p-4", [class]="…"
PropsheaderRows={1}, size="A4"[headerRows]="1", size="A4" (an attribute is a string: bind numbers)
A prop that is truehyphenatehyphenate
Stylestyle={{ padding: 20 }}[style]="{ padding: 20 }"; [inkStyle] for @media blocks and lists of styles
Content per pagerender={({ pageNumber }) => …}[render]="footer" with <ng-template #footer let-page>{{ page.pageNumber }}</ng-template>
The page, deeper downusePage()injectPage()
What to render<Invoice invoice={invoice} />{ component: Invoice, inputs: { invoice } }
A template for generateTemplate: ComponentType<{ data }>Template: a component with the input data

The rest, and Angular’s own API, is in the Angular guide.

Style objects

<View style={{ padding: 12, borderBottomWidth: 0.5, borderBottomColor: '#ddd' }} />
<View style={[styles.row, index % 2 === 1 && styles.zebra]} />
<Text style={{ fontSize: '9pt', marginTop: '2mm' }} />
  • Units. Numbers are points (1/72 inch). Strings may use pt, mm, cm, in, px (0.75pt), pc (12pt), rem (12pt, as in Tailwind), em (the element's font size; in fontSize, the inherited one; in lineHeight and letterSpacing, the size of the text they apply to, so they scale with each run), vw and vh (1% of the page's width and height), or a percentage. lineHeight is a multiplier of the text size (1.4, '140%', '1.4em') or a length ('14pt'), which is read as that multiple of the text's own size: a larger run on the line makes the line taller than the length. calc() adds lengths ('calc(10mm + 1em)') or percentages, but not one to the other. A class's arbitrary value (w-[…]) takes the same syntax and reads the same. A page's size takes the units that do not depend on the font or the page. Percentages follow CSS: widths, padding and margins are of the parent's width, and gaps of the element's own size. A percentage height needs a parent with a set height; a child of the Page takes it of the page.

  • Arrays. Falsy entries are skipped and later entries win, over className too, as a later CSS rule does: a later borderRadius: 8 replaces an earlier corner's radius.

  • Shorthands. padding, margin, paddingHorizontal/paddingVertical, per-side keys and flex: 1 (meaning 1 1 0%) all work. border and borderTop, borderRight, borderBottom, borderLeft take CSS strings ('1px solid #e5e7eb', '2pt dashed red', 'none'); a missing style is solid and a missing colour is the text colour. A side wins over border, and borderWidth, borderColor, borderStyle and the per-side keys win over both. inset sets top, right, bottom and left at once (one value, or { top, right, bottom, left }), and those keys win over it.

  • Indents. textIndent (indent-*) indents the first line of a Text. A negative value is a hanging indent: the first line starts that far before the others, so give the Text as much paddingLeft (-indent-4 pl-4).

  • CSS names. textDecoration takes 'underline', 'line-through' or both; a run has one line, so 'underline line-through' draws the line-through. textDecorationColor, textDecorationStyle and textDecorationThickness are the same as decorationColor, decorationStyle and decorationThickness. textOverflow: 'ellipsis' is ellipsis: true (with maxLines). objectFit on an Image or ImageBackground is its fit prop, which wins when both are set. objectPosition on them places the image in its box (see Images). Both throw on other elements.

  • Floats. float: 'left' or 'right' (float-left, float-right) on a child of a column View, a Page or a Cell puts it at that side, as narrow as its content unless it has a width, at or below where it comes in the flow. Text after it wraps beside it line by line, in its own box: a Text with a width, an alignSelf or auto side margins keeps the box it would have without the float, and its lines take the room the float leaves in it. A column View after it, with children and no floats of its own, keeps its width too and lays its children out beside the floats, so that its text wraps beside them in turn (8 such Views deep). Other boxes after it (an Image, a row, a grid, a table, a View with overflow: 'hidden' or an aspectRatio) are narrowed to the room beside the floats over their whole height, or move below them when their content does not fit there. shapeOutside gives a float a shape for the lines beside it to wrap around, as CSS shape-outside: 'circle(50%)', 'ellipse(40% 50% at left)', 'inset(0 0 20% round 8pt)' or 'polygon(0 0, 100% 0, 0 100%)' in its margin box ([shape-outside:circle(50%)] as a class), and shapeMargin keeps the lines that far from it; the float is still placed, and boxes narrowed, by its margin box. clear: 'left', 'right' or 'both' moves an element below the floats before it, and a parent is as tall as its floats. A float moves to the next page with the lines beside it. Floats do not float inside rows or grids, and a box with floats lays its children out top to bottom: the room they leave goes to flexGrow and justifyContent, and flexGrow on a float, flexBasis on the box's children and alignContent are errors.

  • Opacity. opacity applies to each element, not to an element and its children as one group, as CSS does: where children overlap, each shows through the others. opacity: 0 draws nothing, and leaves out the links, form fields and notes of everything inside the element.

  • Inheritance. Text properties (font, size, weight, colour, line height, alignment) pass down from Page and View to the text inside. Box properties apply only to the element that has them.

  • Page media. An '@media …' key holds styles for the pages it matches, so one component can fit the page it lands on:

    const styles = StyleSheet.create({
      grid: {
        flexDirection: 'column',
        '@media (orientation: landscape)': { flexDirection: 'row', gap: 24 },
        '@media (width < 150mm)': { fontSize: 9 },
      },
    });

    A query reads the page: width and height (the whole sheet, margins included, as vw and vh do), aspect-ratio and orientation (a square page is portrait), with min-/max- or the range forms ((400pt <= width < 600pt)), joined by and, or, not and commas. print and all match, screen does not. Lengths take pt, mm, cm, in, px, pc and rem, and are compared to 1/100 pt, so (max-width: 210mm) holds on A4. Blocks apply after the object's own properties, in the order written, and may nest, at most 32 deep (all their queries must match); a later entry of a style array still wins. A block for another page size is read too, so a mistake in it fails on every page. Features of screens (hover, prefers-color-scheme, resolution) are errors. Each Page has one size, so the queries are answered once per page, before layout; a JSON document has no @media (its author knows each page's size).

Tailwind

Write the classes you would write on the web. They are resolved by the Tailwind v4 compiler, in @inkoxide/tailwind, which you install next to @inkoxide/react when you use className:

npm install @inkoxide/tailwind

Without it, style works the same, and a className fails with an error that says to install it.

  • Units are tuned for print: 1rem = 12pt and 1px = 0.75pt. So p-4 is 12pt, text-sm is 10.5pt and text-xs is 9pt. Use arbitrary values for exact sizes: text-[9.5pt], mt-[14pt], w-[60mm].
  • Supported: flexbox, grid, sizing, spacing, the full colour palette with opacity (bg-black/5), borders, per-corner radii, typography, absolute positioning with z-*, and 2D transforms.
  • Page variants read the page as @media does: md:p-4, max-sm:text-xs, min-[200mm]:flex-row, landscape:flex-row, print:hidden, and stacked, sm:landscape:. Breakpoints are Tailwind's: sm 480pt, md 576pt (A4 and Letter portrait are wider), lg 768pt (their landscape is wider), xl 960pt, 2xl 1152pt; a theme can add its own (--breakpoint-a4: 49.6067rem, which is 595.28pt, gives a4: and max-a4:). Write them in rem: Tailwind sorts breakpoints of different units by unit, not by size, so one in pt comes before sm: and loses to it.
  • Not supported: variants for screens and states (hover:, focus:, dark:), container queries (@sm:), shadows, gradients and space-*/divide-* (use gap-* and borders). Using one throws and names the class; in production (NODE_ENV=production) it is logged once and ignored.
  • In a browser, the Tailwind compiler is about 90 KB to download with brotli. The build plugin of @inkoxide/tailwind replaces it with a table of the classes your sources use, a few KB (@inkoxide/tailwind README): plugins: [inkoxideTailwind()] in a Vite config (inkoxideTailwindEsbuild() for esbuild, inkoxideTailwindWebpack() for webpack and Rspack), or withInkoxideTailwind(nextConfig) in next.config.ts for Next.js 15.3 or later, with Turbopack or webpack. The theme's @source directives add to what it scans. Then write each class whole: one put together at run time (`bg-${color}-500`) is not in the table, unless it is in the plugin's safelist. With Turbopack, next dev scans when it starts: restart it for a class that is new since.

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