melony.dev

Configure Fields

Melony offers a variety of field types to handle different kinds of data. Each field type has its own set of configuration options, in addition to the common options shared by all fields.

Common Field Properties

All field types in Melony share these common properties:

  • label: (string) The display label for the field.
  • description: (string) Additional information about the field.
  • isRequired: (boolean) Whether the field is mandatory.
  • default: (any) The default value for the field.
  • isDisplayField: (boolean) Whether this field should be used as the display representation of the record.
  • components: (object) Custom components for displaying and editing the field.
  • hasAccess: (function) A function to determine if the current user has access to this field.
  • filterable: (boolean) Whether the field can be used in filters.
  • sortable: (boolean) Whether the field can be sorted.

Specific Field Types

textField

  • type: "text"
  • maxLength: (number) Maximum allowed length of the text.
  • minLength: (number) Minimum required length of the text.

numberField

  • type: "number"
  • max: (number) Maximum allowed value.
  • min: (number) Minimum allowed value.

checkboxField

  • type: "checkbox"

colorField

  • type: "color"

relationshipField

  • type: "relationship"
  • getSuggestions: (function) Async function to fetch suggestions based on user input.
  • valueAsNumber: (boolean) Whether the relationship value should be treated as a number.
  • displayField: (string) The field from the related entity to use for display.
  • titleKey: (string) The key to use for the title in suggestions.
  • colorKey: (string) The key to use for color coding in suggestions.
  • imageKey: (string) The key to use for images in suggestions.

selectField

  • type: "select"
  • options: (array) An array of objects with label and value properties.

richTextField

  • type: "rich"

imageField

  • type: "image"

emailField

  • type: "email"

passwordField

  • type: "password"

On this page