Skip to main content

SchemaInput

Renders one form field by resolving its schema to a concrete input component.

This is the component the generated forms mount. Reach for a specific input only when you build a form by hand or override one field.

Example​

<SchemaInput
schema={productSchema.fields.price}
source="price"
/>

Props​

NameTypeDefaultDescription
schema (required)FieldSchema—Field schema; drives which input is rendered
sourcestringschema.nameName of the field in the form record
labelstring | ReactElement | falseschema.labelfalse hides the label
helperTextstring | ReactElement | falseschema.helpTextText under the input
readOnlybooleanfrom the viewRenders the value read-only instead of an input
showLabelbooleantrueRenders the label
defaultValuestring | boolean | number—Currently has no effect — the value is not forwarded to the input. Create-form defaults come from the form itself, which collects every schema.defaultValue into its default values
disabledbooleanfalseDisables the input while keeping it in the form
recordRaRecordrecord from contextRenders a record other than the one in context
onChange() => void—Called after the value changes
hiddenElReactElement—Rendered in place of the input when dynamicRender.showQuery hides it

What it does​

  1. Picks read-only or editable content — a read-only field renders through the field components, not the inputs.
  2. Asks the active InputProvider for a component matching schema.type and schema.format; defaultInputProvider is the fallback.
  3. Evaluates options.dynamicRender against the form's current values: showQuery hides the input (rendering hiddenEl in its place) and requiredQuery makes it required. Inside a schema layout the layout hides the input instead, so the space it takes goes with it: a detail row drops its label too, a datagrid cell stays and only its content goes.
  4. Attaches the field's validators: required() when the schema says so, plus one validator per rule in options.validators, resolved through the validator provider.

Schema mapping​

The dispatch table below is defaultInputProvider. format wins over type.

typeformatInput
boolean—BooleanInput, or TriStateBooleanInput in a filter
number—NumberInput (2–5 fraction digits)
integer—NumberInput (0 fraction digits)
integer / stringrelation, tree-relationSchemaReferenceInput
integer / stringchoicesChoicesInput
string—TextInput
stringtextTextInput (multiline)
stringemail, url, passwordTextInput with the matching HTML input type
stringdate / date-time / timeDateInput / DateTimeInput, TimeInput
stringrich-textRichTextInput from ra-input-rich-text
stringdecimalNumberInput
stringphonePhoneNumberInput
stringsearchReact Admin SearchInput
stringai, ai-textSchemaPredictiveTextInput
stringczech-*Czech local flavor inputs
objectbase64-imageUploadInput with an image preview, maxFiles: 1
objectbase64-fileUploadInput, maxFiles: 1
objectrangeDateRangeInput when both bounds are dates, otherwise SchemaRangeInput
object— (with properties)SchemaObjectInput
arrayitems base64-image / base64-fileUploadInput in multi-file mode
arrayitems of type objectSchemaObjectArrayInput
array—SchemaArrayInput
tip

A field that renders no input usually has a schema the provider cannot resolve — an object without properties, or an array without items.

See also​