Text
Paragraphs, the runs inside them, and links.
Import them from @inkoxide/react, @inkoxide/vue or @inkoxide/svelte; an Angular template writes them as <ink-text>, <ink-link>. Examples, and how these components work together, are in the guide.
Text
A paragraph, or a run inside one; inside an <Svg>, SVG text (SvgTextProps).
import { Document, Page, Text } from '@inkoxide/react';
export default function Example() {
return (
<Document lang="en-US">
<Page size={[320, 160]} className="p-6">
<Text className="text-justify leading-relaxed" hyphenate>
A paragraph is a <Text className="font-bold">Text</Text>, and a Text inside it is a run with its own
style: <Text className="text-orange-700 italic">a colour</Text>, a weight or a size. Long words are
hyphenated with the patterns of the document’s language.
</Text>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Text } from '@inkoxide/vue';
</script>
<template>
<Document lang="en-US">
<Page :size="[320, 160]" class="p-6">
<Text class="text-justify leading-relaxed" hyphenate>
A paragraph is a <Text class="font-bold">Text</Text>, and a Text inside it is a run with its own
style: <Text class="text-orange-700 italic">a colour</Text>, a weight or a size. Long words are
hyphenated with the patterns of the document’s language.
</Text>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Text } from '@inkoxide/svelte';
</script>
<Document lang="en-US">
<Page size={[320, 160]} class="p-6">
<Text class="text-justify leading-relaxed" hyphenate>
A paragraph is a <Text class="font-bold">Text</Text>, and a Text inside it is a run with its own
style: <Text class="text-orange-700 italic">a colour</Text>, a weight or a size. Long words are
hyphenated with the patterns of the document’s language.
</Text>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document lang="en-US">
<ink-page [size]="[320, 160]" class="p-6">
<ink-text class="text-justify leading-relaxed" hyphenate>
A paragraph is a <ink-text class="font-bold">Text</ink-text>, and a Text inside it is a run with its own
style: <ink-text class="text-orange-700 italic">a colour</ink-text>, a weight or a size. Long words are
hyphenated with the patterns of the document’s language.
</ink-text>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Default | Description |
|---|---|---|---|
role | Role | What the text is in tagged output: 'h1'–'h6', 'caption', 'label'…; default a paragraph. | |
hyphenate | boolean | Hyphenate this text (same as hyphens-auto). Needs patterns for its language, so set lang on the text or the Document: without one, nothing is hyphenated and a warning says so. false (hyphens-none) also turns off the registered hyphenationCallback. | |
lang | string | Language of this text, when it differs from the document's. | |
hyphenationCallback | HyphenationCallback | null | Breaks words where this function says, instead of the built-in patterns (hyphenate), which then leave this text alone. Overrides the registered callback (Font.registerHyphenationCallback); null turns it off for this text, which goes back to hyphenate. | |
dir | 'ltr' | 'rtl' | 'auto' | Base direction: rtl for Arabic or Hebrew paragraphs, auto from the first strong letter. | |
orphans | number | 1 | Minimum lines left at the bottom of a page before a break. |
widows | number | 1 | Minimum lines carried to the top of the next page. |
hyphenationPenalty | number | How much textWrap: 'pretty' avoids breaking at a hyphenation point: 0 to 10 000, default 50 (TeX's \hyphenpenalty). Higher values give fewer hyphens and looser lines; 10 000 never breaks a word at one, whatever textWrap. Inherited, and style takes it too. | |
render | RenderProp | ||
x | SvgNumberList | Where the text starts (with textAnchor); a list positions each character. | |
y | SvgNumberList | ||
dx | SvgNumberList | Shifts from where each character would be. | |
dy | SvgNumberList | ||
rotate | SvgNumberList | Degrees each character is turned; the last value repeats. | |
letterSpacing | number | string | ||
wordSpacing | number | string | ||
textDecoration | string | underline, overline, line-through, or several. | |
textLength | number | string | The width to fit the text to, by its spacing or (lengthAdjust) its glyphs too. | |
lengthAdjust | 'spacing' | 'spacingAndGlyphs' | ||
direction | 'ltr' | 'rtl' | ||
writingMode | 'horizontal-tb' | 'vertical-rl' | 'vertical-lr' | 'sideways-rl' | 'sideways-lr' | The direction of the line: vertical-rl and vertical-lr (the same for one line) go down, sideways-rl down with every character turned, sideways-lr up. Read on the Text. | |
textOrientation | 'mixed' | 'upright' | 'sideways' | How characters stand in vertical text: mixed (the default) stands CJK upright and turns Latin sideways, upright stands every character, sideways turns every one. | |
fontFeatureSettings | string | OpenType features, as in CSS: "'tnum', 'liga' off". | |
fontVariant | string | small-caps, tabular-nums, no-common-ligatures, … as in CSS. | |
fontKerning | 'auto' | 'normal' | 'none' | none turns kerning off. |
It also takes the shared props break, wrap, minPresenceAhead, fixed, pages, href, bookmark, className, style, id, debug.
Link
A link to href (https://…, mailto:… or #id; src is the same). Inside a Text it is an inline run; elsewhere a box, like a View with href. It adds no colour or underline.
import { Document, Link, Page, Text } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 120]} className="p-6">
<Text>
Read the{' '}
<Link href="https://inkoxide.dev/docs" className="text-orange-700 underline">
documentation
</Link>
, or write to{' '}
<Link href="mailto:[email protected]" className="text-orange-700 underline">
[email protected]
</Link>
.
</Text>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Link, Page, Text } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 120]" class="p-6">
<Text>
Read the
<Link href="https://inkoxide.dev/docs" class="text-orange-700 underline">
documentation
</Link>, or write to
<Link href="mailto:[email protected]" class="text-orange-700 underline">
[email protected]
</Link>.
</Text>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Link, Page, Text } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 120]} class="p-6">
<Text>
Read the
<Link href="https://inkoxide.dev/docs" class="text-orange-700 underline">
documentation
</Link>, or write to
<Link href="mailto:[email protected]" class="text-orange-700 underline">
[email protected]
</Link>.
</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, 120]" class="p-6">
<ink-text>
Read the
<ink-link href="https://inkoxide.dev/docs" class="text-orange-700 underline">
documentation
</ink-link>, or write to
<ink-link href="mailto:[email protected]" class="text-orange-700 underline">
hello@example.com
</ink-link>.
</ink-text>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
src | string |
It also takes the shared props break, wrap, minPresenceAhead, fixed, pages, href, bookmark, className, style, id, debug.
Synced from components/text.md in the inkoxide repository.