Skip to content
Inkoxide

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

Form fields

Text fields, checkboxes, radio buttons, selects and lists that can be filled in any PDF viewer.

Edit this page

Import them from @inkoxide/react, @inkoxide/vue or @inkoxide/svelte; an Angular template writes them as <ink-text-field>, <ink-text-input>, <ink-checkbox>, <ink-radio>, <ink-select>, <ink-list>, <ink-field>, <ink-field-set>. Examples, and how these components work together, are in the guide.

TextField

A text field.

import { Document, Page, Text, TextField, View } from '@inkoxide/react';

export default function Example() {
  return (
    <Document>
      <Page size={[320, 120]} className="p-6 text-xs">
        <View className="gap-2">
          <Text className="font-bold">Email</Text>
          <TextField name="email" value="[email protected]" className="h-6 w-full rounded border border-gray-300 px-1" />
        </View>
      </Page>
    </Document>
  );
}
<script setup lang="ts">
import { Document, Page, Text, TextField, View } from '@inkoxide/vue';
</script>

<template>
  <Document>
    <Page :size="[320, 120]" class="p-6 text-xs">
      <View class="gap-2">
        <Text class="font-bold">Email</Text>
        <TextField name="email" value="[email protected]" class="h-6 w-full rounded border border-gray-300 px-1" />
      </View>
    </Page>
  </Document>
</template>
<script lang="ts">
  import { Document, Page, Text, TextField, View } from '@inkoxide/svelte';
</script>

<Document>
  <Page size={[320, 120]} class="p-6 text-xs">
    <View class="gap-2">
      <Text class="font-bold">Email</Text>
      <TextField name="email" value="[email protected]" class="h-6 w-full rounded border border-gray-300 px-1" />
    </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, 120]" class="p-6 text-xs">
        <ink-view class="gap-2">
          <ink-text class="font-bold">Email</ink-text>
          <ink-text-field name="email" value="[email protected]" class="h-6 w-full rounded border border-gray-300 px-1" />
        </ink-view>
      </ink-page>
    </ink-document>
  `,
})
export class Example {}
The PDF this example renders.
PropTypeDescription
valuestring
multilineboolean
passwordbooleanThe value is neither shown nor stored.
maxLengthnumber
formatTextFormatHow the value shows and is typed: a number, a date, a phone number…
noSpellbooleanViewers do not check the spelling of what is typed.
alignFieldAlign
name (required)stringField name, unique in the document (radio buttons of one group share it). A <FieldSet> puts its name in front; dots make groups the same way (address.street).
readOnlyboolean
requiredboolean
labelstringWhat the field is for: what screen readers say, and the tooltip. PDF/UA requires it.

It also takes the shared props break, wrap, minPresenceAhead, pages, className, style, id, debug.

TextInput

The same as TextField.

import { Document, Page, Text, TextInput, View } from '@inkoxide/react';

export default function Example() {
  return (
    <Document>
      <Page size={[320, 120]} className="p-6 text-xs">
        <View className="gap-2">
          <Text className="font-bold">Name</Text>
          <TextInput name="name" className="h-6 w-full rounded border border-gray-300 px-1" />
        </View>
      </Page>
    </Document>
  );
}
<script setup lang="ts">
import { Document, Page, Text, TextInput, View } from '@inkoxide/vue';
</script>

<template>
  <Document>
    <Page :size="[320, 120]" class="p-6 text-xs">
      <View class="gap-2">
        <Text class="font-bold">Name</Text>
        <TextInput name="name" class="h-6 w-full rounded border border-gray-300 px-1" />
      </View>
    </Page>
  </Document>
</template>
<script lang="ts">
  import { Document, Page, Text, TextInput, View } from '@inkoxide/svelte';
</script>

<Document>
  <Page size={[320, 120]} class="p-6 text-xs">
    <View class="gap-2">
      <Text class="font-bold">Name</Text>
      <TextInput name="name" class="h-6 w-full rounded border border-gray-300 px-1" />
    </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, 120]" class="p-6 text-xs">
        <ink-view class="gap-2">
          <ink-text class="font-bold">Name</ink-text>
          <ink-text-input name="name" class="h-6 w-full rounded border border-gray-300 px-1" />
        </ink-view>
      </ink-page>
    </ink-document>
  `,
})
export class Example {}
The PDF this example renders.

Checkbox

A checkbox.

import { Checkbox, Document, Page, Text, View } from '@inkoxide/react';

export default function Example() {
  return (
    <Document>
      <Page size={[320, 120]} className="p-6 text-xs">
        <View className="gap-2">
          <View className="flex-row items-center gap-2">
            <Checkbox name="terms" checked className="h-3.5 w-3.5 border border-gray-400" />
            <Text>I accept the terms</Text>
          </View>
          <View className="flex-row items-center gap-2">
            <Checkbox name="news" className="h-3.5 w-3.5 border border-gray-400" />
            <Text>Send me the newsletter</Text>
          </View>
        </View>
      </Page>
    </Document>
  );
}
<script setup lang="ts">
import { Checkbox, Document, Page, Text, View } from '@inkoxide/vue';
</script>

<template>
  <Document>
    <Page :size="[320, 120]" class="p-6 text-xs">
      <View class="gap-2">
        <View class="flex-row items-center gap-2">
          <Checkbox name="terms" checked class="h-3.5 w-3.5 border border-gray-400" />
          <Text>I accept the terms</Text>
        </View>
        <View class="flex-row items-center gap-2">
          <Checkbox name="news" class="h-3.5 w-3.5 border border-gray-400" />
          <Text>Send me the newsletter</Text>
        </View>
      </View>
    </Page>
  </Document>
</template>
<script lang="ts">
  import { Checkbox, Document, Page, Text, View } from '@inkoxide/svelte';
</script>

<Document>
  <Page size={[320, 120]} class="p-6 text-xs">
    <View class="gap-2">
      <View class="flex-row items-center gap-2">
        <Checkbox name="terms" checked class="h-3.5 w-3.5 border border-gray-400" />
        <Text>I accept the terms</Text>
      </View>
      <View class="flex-row items-center gap-2">
        <Checkbox name="news" class="h-3.5 w-3.5 border border-gray-400" />
        <Text>Send me the newsletter</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, 120]" class="p-6 text-xs">
        <ink-view class="gap-2">
          <ink-view class="flex-row items-center gap-2">
            <ink-checkbox name="terms" checked class="h-3.5 w-3.5 border border-gray-400" />
            <ink-text>I accept the terms</ink-text>
          </ink-view>
          <ink-view class="flex-row items-center gap-2">
            <ink-checkbox name="news" class="h-3.5 w-3.5 border border-gray-400" />
            <ink-text>Send me the newsletter</ink-text>
          </ink-view>
        </ink-view>
      </ink-page>
    </ink-document>
  `,
})
export class Example {}
The PDF this example renders.
PropTypeDescription
checkedboolean
name (required)stringField name, unique in the document (radio buttons of one group share it). A <FieldSet> puts its name in front; dots make groups the same way (address.street).
readOnlyboolean
requiredboolean
labelstringWhat the field is for: what screen readers say, and the tooltip. PDF/UA requires it.

It also takes the shared props break, wrap, minPresenceAhead, pages, className, style, id, debug.

Radio

One button of a radio group (buttons share name).

import { Document, Page, Radio, Text, View } from '@inkoxide/react';

export default function Example() {
  return (
    <Document>
      <Page size={[320, 120]} className="p-6 text-xs">
        <View className="gap-2">
          <View className="flex-row items-center gap-2">
            <Radio name="billing" value="monthly" className="h-3.5 w-3.5 rounded-full border border-gray-400" />
            <Text>Monthly</Text>
          </View>
          <View className="flex-row items-center gap-2">
            <Radio name="billing" value="yearly" checked className="h-3.5 w-3.5 rounded-full border border-gray-400" />
            <Text>Yearly</Text>
          </View>
        </View>
      </Page>
    </Document>
  );
}
<script setup lang="ts">
import { Document, Page, Radio, Text, View } from '@inkoxide/vue';
</script>

<template>
  <Document>
    <Page :size="[320, 120]" class="p-6 text-xs">
      <View class="gap-2">
        <View class="flex-row items-center gap-2">
          <Radio name="billing" value="monthly" class="h-3.5 w-3.5 rounded-full border border-gray-400" />
          <Text>Monthly</Text>
        </View>
        <View class="flex-row items-center gap-2">
          <Radio name="billing" value="yearly" checked class="h-3.5 w-3.5 rounded-full border border-gray-400" />
          <Text>Yearly</Text>
        </View>
      </View>
    </Page>
  </Document>
</template>
<script lang="ts">
  import { Document, Page, Radio, Text, View } from '@inkoxide/svelte';
</script>

<Document>
  <Page size={[320, 120]} class="p-6 text-xs">
    <View class="gap-2">
      <View class="flex-row items-center gap-2">
        <Radio name="billing" value="monthly" class="h-3.5 w-3.5 rounded-full border border-gray-400" />
        <Text>Monthly</Text>
      </View>
      <View class="flex-row items-center gap-2">
        <Radio name="billing" value="yearly" checked class="h-3.5 w-3.5 rounded-full border border-gray-400" />
        <Text>Yearly</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, 120]" class="p-6 text-xs">
        <ink-view class="gap-2">
          <ink-view class="flex-row items-center gap-2">
            <ink-radio name="billing" value="monthly" class="h-3.5 w-3.5 rounded-full border border-gray-400" />
            <ink-text>Monthly</ink-text>
          </ink-view>
          <ink-view class="flex-row items-center gap-2">
            <ink-radio name="billing" value="yearly" checked class="h-3.5 w-3.5 rounded-full border border-gray-400" />
            <ink-text>Yearly</ink-text>
          </ink-view>
        </ink-view>
      </ink-page>
    </ink-document>
  `,
})
export class Example {}
The PDF this example renders.
PropTypeDescription
value (required)stringThe value the group exports when this button is selected.
checkedbooleanInitially selected; at most one button of a group.
name (required)stringField name, unique in the document (radio buttons of one group share it). A <FieldSet> puts its name in front; dots make groups the same way (address.street).
readOnlyboolean
requiredboolean
labelstringWhat the field is for: what screen readers say, and the tooltip. PDF/UA requires it.

It also takes the shared props break, wrap, minPresenceAhead, pages, className, style, id, debug.

Select

A drop-down list.

import { Document, Page, Select, Text, View } from '@inkoxide/react';

export default function Example() {
  return (
    <Document>
      <Page size={[320, 120]} className="p-6 text-xs">
        <View className="gap-2">
          <Text className="font-bold">Plan</Text>
          <Select name="plan" options={['Starter', 'Team', 'Enterprise']} value="Team" className="h-6 w-40 rounded border border-gray-300 px-1" />
        </View>
      </Page>
    </Document>
  );
}
<script setup lang="ts">
import { Document, Page, Select, Text, View } from '@inkoxide/vue';
</script>

<template>
  <Document>
    <Page :size="[320, 120]" class="p-6 text-xs">
      <View class="gap-2">
        <Text class="font-bold">Plan</Text>
        <Select name="plan" :options="['Starter', 'Team', 'Enterprise']" value="Team" class="h-6 w-40 rounded border border-gray-300 px-1" />
      </View>
    </Page>
  </Document>
</template>
<script lang="ts">
  import { Document, Page, Select, Text, View } from '@inkoxide/svelte';
</script>

<Document>
  <Page size={[320, 120]} class="p-6 text-xs">
    <View class="gap-2">
      <Text class="font-bold">Plan</Text>
      <Select name="plan" options={['Starter', 'Team', 'Enterprise']} value="Team" class="h-6 w-40 rounded border border-gray-300 px-1" />
    </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, 120]" class="p-6 text-xs">
        <ink-view class="gap-2">
          <ink-text class="font-bold">Plan</ink-text>
          <ink-select name="plan" [options]="['Starter', 'Team', 'Enterprise']" value="Team" class="h-6 w-40 rounded border border-gray-300 px-1" />
        </ink-view>
      </ink-page>
    </ink-document>
  `,
})
export class Example {}
The PDF this example renders.
PropTypeDescription
name (required)stringField name, unique in the document (radio buttons of one group share it). A <FieldSet> puts its name in front; dots make groups the same way (address.street).
readOnlyboolean
requiredboolean
labelstringWhat the field is for: what screen readers say, and the tooltip. PDF/UA requires it.
optionsstring[]
selectnever
valuestringThe selected option; with edit, any text.
sortbooleanThe options in alphabetical order.
editbooleanA value can be typed besides the options.
noSpellbooleanWith edit: viewers do not check the spelling of what is typed.
alignFieldAlign

It also takes the shared props break, wrap, minPresenceAhead, pages, className, style, id, debug.

List

A list box: several options in view (four without a height), one or several selected.

import { Document, List, Page, Text, View } from '@inkoxide/react';

export default function Example() {
  return (
    <Document>
      <Page size={[320, 150]} className="p-6 text-xs">
        <View className="gap-2">
          <Text className="font-bold">Days</Text>
          <List name="days" options={['Mon', 'Tue', 'Wed', 'Thu', 'Fri']} multiSelect value={['Mon', 'Wed']} className="w-40 border border-gray-300" />
        </View>
      </Page>
    </Document>
  );
}
<script setup lang="ts">
import { Document, List, Page, Text, View } from '@inkoxide/vue';
</script>

<template>
  <Document>
    <Page :size="[320, 150]" class="p-6 text-xs">
      <View class="gap-2">
        <Text class="font-bold">Days</Text>
        <List name="days" :options="['Mon', 'Tue', 'Wed', 'Thu', 'Fri']" multiSelect :value="['Mon', 'Wed']" class="w-40 border border-gray-300" />
      </View>
    </Page>
  </Document>
</template>
<script lang="ts">
  import { Document, List, Page, Text, View } from '@inkoxide/svelte';
</script>

<Document>
  <Page size={[320, 150]} class="p-6 text-xs">
    <View class="gap-2">
      <Text class="font-bold">Days</Text>
      <List name="days" options={['Mon', 'Tue', 'Wed', 'Thu', 'Fri']} multiSelect value={['Mon', 'Wed']} class="w-40 border border-gray-300" />
    </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, 150]" class="p-6 text-xs">
        <ink-view class="gap-2">
          <ink-text class="font-bold">Days</ink-text>
          <ink-list name="days" [options]="['Mon', 'Tue', 'Wed', 'Thu', 'Fri']" multiSelect [value]="['Mon', 'Wed']" class="w-40 border border-gray-300" />
        </ink-view>
      </ink-page>
    </ink-document>
  `,
})
export class Example {}
The PDF this example renders.
PropTypeDescription
name (required)stringField name, unique in the document (radio buttons of one group share it). A <FieldSet> puts its name in front; dots make groups the same way (address.street).
readOnlyboolean
requiredboolean
labelstringWhat the field is for: what screen readers say, and the tooltip. PDF/UA requires it.
optionsstring[]
selectnever
sortbooleanThe options in alphabetical order.
alignFieldAlign
multiSelectfalse
valuestringThe selected option.

It also takes the shared props break, wrap, minPresenceAhead, pages, className, style, id, debug.

Field

An interactive form field (AcroForm).

import { Document, Field, Page, Text, View } from '@inkoxide/react';

// A form built from data: each question picks its field by `kind`.
const questions = [
  { kind: 'text', name: 'company', label: 'Company' },
  { kind: 'checkbox', name: 'invoice', label: 'Send an invoice' },
] as const;

export default function Example() {
  return (
    <Document>
      <Page size={[320, 130]} className="p-6 text-xs">
        <View className="gap-3">
          {questions.map((q) => (
            <View key={q.name} className="gap-1">
              <Text className="font-bold">{q.label}</Text>
              {q.kind === 'text' ? (
                <Field kind="text" name={q.name} className="h-6 w-full rounded border border-gray-300 px-1" />
              ) : (
                <Field kind="checkbox" name={q.name} className="h-3.5 w-3.5 border border-gray-400" />
              )}
            </View>
          ))}
        </View>
      </Page>
    </Document>
  );
}
<script setup lang="ts">
import { Document, Field, Page, Text, View } from '@inkoxide/vue';

// A form built from data: each question picks its field by `kind`.
const questions = [
  { kind: 'text', name: 'company', label: 'Company' },
  { kind: 'checkbox', name: 'invoice', label: 'Send an invoice' },
] as const;
</script>

<template>
  <Document>
    <Page :size="[320, 130]" class="p-6 text-xs">
      <View class="gap-3">
        <View class="gap-1" v-for="q in questions" :key="q.name">
          <Text class="font-bold">{{ q.label }}</Text>
          <Field kind="text" :name="q.name" class="h-6 w-full rounded border border-gray-300 px-1" v-if="q.kind === 'text'" />
          <Field kind="checkbox" :name="q.name" class="h-3.5 w-3.5 border border-gray-400" v-else />
        </View>
      </View>
    </Page>
  </Document>
</template>
<script lang="ts">
  import { Document, Field, Page, Text, View } from '@inkoxide/svelte';

  // A form built from data: each question picks its field by `kind`.
  const questions = [
    { kind: 'text', name: 'company', label: 'Company' },
    { kind: 'checkbox', name: 'invoice', label: 'Send an invoice' },
  ] as const;
</script>

<Document>
  <Page size={[320, 130]} class="p-6 text-xs">
    <View class="gap-3">
      {#each questions as q (q.name)}
        <View class="gap-1">
          <Text class="font-bold">{q.label}</Text>
          {#if q.kind === 'text'}
            <Field kind="text" name={q.name} class="h-6 w-full rounded border border-gray-300 px-1" />
          {:else}
            <Field kind="checkbox" name={q.name} class="h-3.5 w-3.5 border border-gray-400" />
          {/if}
        </View>
      {/each}
    </View>
  </Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

// A form built from data: each question picks its field by `kind`.
const questions = [
  { kind: 'text', name: 'company', label: 'Company' },
  { kind: 'checkbox', name: 'invoice', label: 'Send an invoice' },
] as const;

@Component({
  selector: 'app-example',
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <ink-document>
      <ink-page [size]="[320, 130]" class="p-6 text-xs">
        <ink-view class="gap-3">
          @for (q of questions; track q.name) {
            <ink-view class="gap-1">
              <ink-text class="font-bold">{{ q.label }}</ink-text>
              @if (q.kind === 'text') {
                <ink-field kind="text" [name]="q.name" class="h-6 w-full rounded border border-gray-300 px-1" />
              } @else {
                <ink-field kind="checkbox" [name]="q.name" class="h-3.5 w-3.5 border border-gray-400" />
              }
            </ink-view>
          }
        </ink-view>
      </ink-page>
    </ink-document>
  `,
})
export class Example {
  readonly questions = questions;
}
The PDF this example renders.
PropTypeDescription
kind (required)'text' | 'checkbox' | 'radio' | 'select' | 'list'Which field: the other props are those of TextField, Checkbox, Radio, Select or List.

FieldSet

A group of form fields: a View whose name goes in front of the name of every field inside it, at any depth (<FieldSet name="address"><TextField name="street" /></FieldSet> is the field address.street). Sets nest: a.b.c.

import { Document, FieldSet, Page, Text, TextField, View } from '@inkoxide/react';

export default function Example() {
  return (
    <Document>
      <Page size={[320, 150]} className="p-6 text-xs">
        <View className="gap-2">
          <FieldSet name="billing" className="gap-2">
            <Text className="font-bold">Street (billing.street)</Text>
            <TextField name="street" className="h-6 w-full rounded border border-gray-300 px-1" />
            <Text className="font-bold">City (billing.city)</Text>
            <TextField name="city" className="h-6 w-full rounded border border-gray-300 px-1" />
          </FieldSet>
        </View>
      </Page>
    </Document>
  );
}
<script setup lang="ts">
import { Document, FieldSet, Page, Text, TextField, View } from '@inkoxide/vue';
</script>

<template>
  <Document>
    <Page :size="[320, 150]" class="p-6 text-xs">
      <View class="gap-2">
        <FieldSet name="billing" class="gap-2">
          <Text class="font-bold">Street (billing.street)</Text>
          <TextField name="street" class="h-6 w-full rounded border border-gray-300 px-1" />
          <Text class="font-bold">City (billing.city)</Text>
          <TextField name="city" class="h-6 w-full rounded border border-gray-300 px-1" />
        </FieldSet>
      </View>
    </Page>
  </Document>
</template>
<script lang="ts">
  import { Document, FieldSet, Page, Text, TextField, View } from '@inkoxide/svelte';
</script>

<Document>
  <Page size={[320, 150]} class="p-6 text-xs">
    <View class="gap-2">
      <FieldSet name="billing" class="gap-2">
        <Text class="font-bold">Street (billing.street)</Text>
        <TextField name="street" class="h-6 w-full rounded border border-gray-300 px-1" />
        <Text class="font-bold">City (billing.city)</Text>
        <TextField name="city" class="h-6 w-full rounded border border-gray-300 px-1" />
      </FieldSet>
    </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, 150]" class="p-6 text-xs">
        <ink-view class="gap-2">
          <ink-field-set name="billing" class="gap-2">
            <ink-text class="font-bold">Street (billing.street)</ink-text>
            <ink-text-field name="street" class="h-6 w-full rounded border border-gray-300 px-1" />
            <ink-text class="font-bold">City (billing.city)</ink-text>
            <ink-text-field name="city" class="h-6 w-full rounded border border-gray-300 px-1" />
          </ink-field-set>
        </ink-view>
      </ink-page>
    </ink-document>
  `,
})
export class Example {}
The PDF this example renders.
PropTypeDescription
name (required)stringThe group's name, put in front of the name of every field inside it: address.street.
renderRenderProp
roleRoleWhat the view is in tagged output; by default it is not an element of its own.
altstringA 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.

Synced from components/forms.md in the inkoxide repository.