GitHub

Common Form Attributes

Common form attributes are attributes that are shared by a variety of elements.

import { View, Text, TextInput } from '@react-pdf/renderer';

const field = { height: 18, borderWidth: 1, borderColor: '#c9c2b6' };
const label = { fontSize: 9, color: '#3e3e3e', marginBottom: 4 };

const Reference = () => (
  <View>
    <Text style={label}>Reference</Text>
    <TextInput
      name="ref"
      value="INV-0042"
      defaultValue="INV-0042"
      required
      readOnly
      style={field}
    />
  </View>
);
Show preview

Supported attributes

Prop nameDescriptionTypeDefault
nameDescribes the name of the specific element when submitting the formStringempty
requiredDescribes if the specific element needs to have a value when submitting the formBooleanfalse
noExportIf set to true the specific element is not exported at a form submissionBooleanfalse
readOnlyDefines if the specific element is editable or not. If set to true, the user shall not edit the value.Booleanfalse
valueDefines the value of the specific element. For further information look at the element.String, Numberundefined
defaultValueDescribes what the default state for the value is. Can be used when resetting the form.String, Numberundefined

On this page