typeUserAttrs

Define custom attributes for field types with this handy option.

Attribute input types are generated using the typeof for the value. Custom attribute definitions function similarly to custom field definitions where label and options are "special" attributes, all non-"special" attributes such as required, style, and multiple are added to the input being created.

Example Multiple Select

const typeUserAttrs = {
  text: {
    shape: {
      label: 'Class', // i18n support by passing and array eg. ['optionCount', {count: 3}]
      multiple: true, // optional, omitting generates normal <select>
      options: {
        'red form-control': 'Red',
        'green form-control': 'Green',
        'blue form-control': 'Blue'
      },
      style: 'border: 1px solid red'
    }
  }
};

Example with i18n support

Example Checkbox

const typeUserAttrs = {
  text: {
    readonly: {
      label: 'readonly',
      value: false,
    }
  }
};

Example Text Input

const typeUserAttrs = {
  text: {
    title: {
      label: 'Title',
      value: 'Field Title',
    }
  }
};

Example Number Inputs

const typeUserAttrs = {
  text: {
    min: {
      label: 'Min',
      value: 1,
    },
    max: {
      label: 'Max',
      value: 10,
    }
  }
};

Usage