View
The box everything is laid out in: flexbox, grid, and empty space.
Import them from @inkoxide/react, @inkoxide/vue or @inkoxide/svelte; an Angular template writes them as <ink-view>, <ink-spacer>. Examples, and how these components work together, are in the guide.
View
A box: flex column by default, and also grid.
import { Document, Page, Text, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 130]} className="p-6">
<View className="flex-row gap-3">
<View className="flex-1 rounded-md bg-orange-100 p-3">
<Text className="text-xs text-orange-800">Revenue</Text>
<Text className="text-lg font-bold">$3.0M</Text>
</View>
<View className="flex-1 rounded-md bg-stone-100 p-3">
<Text className="text-xs text-gray-500">Orders</Text>
<Text className="text-lg font-bold">15,990</Text>
</View>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Text, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 130]" class="p-6">
<View class="flex-row gap-3">
<View class="flex-1 rounded-md bg-orange-100 p-3">
<Text class="text-xs text-orange-800">Revenue</Text>
<Text class="text-lg font-bold">$3.0M</Text>
</View>
<View class="flex-1 rounded-md bg-stone-100 p-3">
<Text class="text-xs text-gray-500">Orders</Text>
<Text class="text-lg font-bold">15,990</Text>
</View>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Text, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 130]} class="p-6">
<View class="flex-row gap-3">
<View class="flex-1 rounded-md bg-orange-100 p-3">
<Text class="text-xs text-orange-800">Revenue</Text>
<Text class="text-lg font-bold">$3.0M</Text>
</View>
<View class="flex-1 rounded-md bg-stone-100 p-3">
<Text class="text-xs text-gray-500">Orders</Text>
<Text class="text-lg font-bold">15,990</Text>
</View>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 130]" class="p-6">
<ink-view class="flex-row gap-3">
<ink-view class="flex-1 rounded-md bg-orange-100 p-3">
<ink-text class="text-xs text-orange-800">Revenue</ink-text>
<ink-text class="text-lg font-bold">$3.0M</ink-text>
</ink-view>
<ink-view class="flex-1 rounded-md bg-stone-100 p-3">
<ink-text class="text-xs text-gray-500">Orders</ink-text>
<ink-text class="text-lg font-bold">15,990</ink-text>
</ink-view>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
render | RenderProp | |
role | Role | What the view is in tagged output; by default it is not an element of its own. |
alt | string | A role="figure" view's alternative text: what screen readers say for it. |
It also takes the shared props break, wrap, minPresenceAhead, fixed, pages, href, bookmark, className, style, id, debug.
Spacer
A forced page break; empty space.
import { Document, Page, Spacer, Text } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 130]} className="p-6">
<Text className="font-bold">Above</Text>
<Spacer h={36} />
<Text className="font-bold">36 points below</Text>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Spacer, Text } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 130]" class="p-6">
<Text class="font-bold">Above</Text>
<Spacer :h="36" />
<Text class="font-bold">36 points below</Text>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Spacer, Text } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 130]} class="p-6">
<Text class="font-bold">Above</Text>
<Spacer h={36} />
<Text class="font-bold">36 points below</Text>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 130]" class="p-6">
<ink-text class="font-bold">Above</ink-text>
<ink-spacer [h]="36" />
<ink-text class="font-bold">36 points below</ink-text>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
h | number | Height in points. |
w | number | Width in points. |
className | string | |
style | Style | |
id | string | |
debug | boolean | Outlines the spacer's box. |
Synced from components/view.md in the inkoxide repository.