Skip to main content

Input provider

Replaces the component that collects a field's value in a form.

Use it for an input the library does not ship — a colour picker, a map location, or an existing input wired to something extra (the ARES lookup in CzechIcoInput is exactly this case).

Signature​

type AdminInputProvider = (props: {
resource?: string;
source: string;
type: FieldType;
format?: FieldFormatType;
schema?: FieldSchema;
locale?: string;
isFilter?: boolean;
props: InputProps;
}) => ReactElement | undefined | null;

The resource-level provider receives the same object without resource.

Parameters​

NameTypeDescription
resourcestringResource the field belongs to; admin-wide provider only
sourcestringField path in the form record
typeFieldTypeJSON type from the schema
formatFieldFormatTypeFormat from the schema, when it has one
schemaFieldSchemaThe field's full schema, including enum and options
localestringActive admin locale
isFilterbooleantrue when the input is rendered in a filter, not in a form
propsInputPropsProps Habarico prepared — spread them into your component

Returns​

The element to render, undefined to let the next provider decide, or null to render nothing at all. See how an override is resolved.

Example​

<SchemaAdmin
inputProvider={({format, props}) => {
if (format === 'czech-ico') {
return <IcoInput {...props} />; // CzechIcoInput plus an onAresDataLoaded handler
}
}}
>
<SchemaResource name="eshop/customer" />
</SchemaAdmin>
tip

isFilter is what lets one override behave differently in a filter — a filter needs a “don't care” state that a form input does not. defaultInputProvider uses it exactly once, to swap the boolean checkbox for a tri-state toggle.

Default mapping​

When no provider claims a field, defaultInputProvider decides — its table is on the SchemaInput page.

See also​