Specification
Interface

Interface

Describe how elements in the interface should render.

const config = {
    ...,
    fields: {
        exampleKey: {
            schema: {
                type: "string"
            },
            interface: {
                label: "Example",
                form: {
                    description: "Small text that'll render near the input",
                    placeholder: "Input placeholder text...",
                    hidden: false,
                    disabled: false,
                    options:
                }
            }
        }
    }
}

label

TypeRequiredDefault
stringNoundefined

User-friendly name for the key. Will render on the form and the table's column.

form

Describe how elements should render inside the Create and Update forms.

out_key

TypeRequiredDefault
stringNoundefined

When Interweave creates your object from the inputs, it assumes a flat structure, and that the key of your field will equal the key in your request body. So for example...

This configuration:

Input
const config = {
    key: ...,
    fields: {
        companyName: {
            schema: {
                type: "string"
                default_value: "Interweave"
            }
        }
    }
}

Will create this object after the form is submitted:

Output
{
  "companyName": "Interweave"
}

You can use the out_key to change what the key gets output as. For example...

This configuration:

Input
const config = {
    key: ...,
    fields: {
        companyName: {
            schema: {
                type: "string"
                default_value: "Interweave"
            },
            interface: {
                form: {
                    out_key: "company"
                }
            }
        }
    }
}

Will create this object after the form is submitted:

Output
{
  "company": "Interweave"
}

You can also use dot notation to deep-set inside the objects:

Input
const config = {
    key: ...,
    fields: {
        companyName: {
            schema: {
                type: "string"
                default_value: "Interweave"
            },
            interface: {
                form: {
                    out_key: "company.name"
                }
            }
        }
    }
}
Output
{
  "company": {
    "name": "Interweave"
  }
}

description

TypeRequiredDefault
stringNoundefined

Helper text to render near the input element

placeholder

TypeRequiredDefault
stringNoundefined

Placeholder text to render on the element

hidden

TypeRequiredDefault
booleanNoundefined

Whether to hide this element from the interface. Hiding the element in the form will skip its validation client-side. Useful for fields that get set server-side like id.

disabled

TypeRequiredDefault
booleanNoundefined

Whether a user can interact with this element or not.


table

hidden

TypeRequiredDefault
booleanNoundefined

Whether this column gets rendered on the table.

column_width

TypeRequiredDefault
numberNoundefined

Width of the column to override the defaults.

plugins

A reserved key for other applications that may want to consume your Interweave object.