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/render. Examples, and how these components work together, are in the guide.

TextField

A text field.

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

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="ada@example.com" className="h-6 w-full rounded border border-gray-300 px-1" />
        </View>
      </Page>
    </Document>
  );
}
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…
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

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/render';

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>
  );
}
The PDF this example renders.

Checkbox

A checkbox.

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

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>
  );
}
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

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/render';

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>
  );
}
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

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/render';

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>
  );
}
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
optionsstring[]
selectnever
valuestringThe selected option.

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/render';

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>
  );
}
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
optionsstring[]
selectnever
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/render';

// 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>
  );
}
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/render';

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>
  );
}
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

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.