register-form-input-component.md 1.8 KB


title: "RegisterFormInputComponent"

generated: true

registerFormInputComponent

Registers a custom FormInputComponent which can be used to control the argument inputs of a ConfigurableOperationDef (e.g. CollectionFilter, ShippingMethod etc.) or for a custom field.

Example

import { registerFormInputComponent } from '@vendure/admin-ui/core';

export default [
    // highlight-next-line
    registerFormInputComponent('my-custom-input', MyCustomFieldControl),
];

This input component can then be used in a custom field:

Example

import { VendureConfig } from '@vendure/core';

const config: VendureConfig = {
  // ...
  customFields: {
    ProductVariant: [
      {
        name: 'rrp',
        type: 'int',
        // highlight-next-line
        ui: { component: 'my-custom-input' },
      },
    ]
  }
}

or with an argument of a ConfigurableOperationDef:

Example

args: {
  rrp: { type: 'int', ui: { component: 'my-custom-input' } },
}
function registerFormInputComponent(id: string, component: Type<FormInputComponent>): void

Parameters

id

component

FormInputComponent>`} />