Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheConfigurableForm component (PF-17) provides a dynamic, configuration-driven form renderer that eliminates the need for hardcoded forms. It supports:
- Standard fields from entity table columns
- Custom fields from
pf_custom_field_definitions - Picklist-based selects from
pf_picklists - Lookup fields for entity references (accounts, customers, etc.)
- Field visibility based on roles and conditional rules
- Configurable layouts with sections and column spans
Quick Start
Basic Usage
Props
| Prop | Type | Required | Description |
|---|---|---|---|
entityType | string | Yes | Entity type key (e.g., fa_customers, hr_employees) |
viewContext | ViewContext | No | One of: create_form, edit_form, detail_view, list_view. Defaults to edit_form |
initialData | Record<string, any> | No | Initial values for form fields |
onSubmit | (data) => void | Yes | Callback when form is submitted |
onCancel | () => void | No | Callback when Cancel button is clicked |
userRole | string | No | Current user’s role for field visibility checks |
isSubmitting | boolean | No | Shows loading state on submit button |
submitLabel | string | No | Custom text for submit button |
Field Types
Standard Field Types
The following types are supported inSTANDARD_FIELDS:
| Type | Renderer | Description |
|---|---|---|
text | <Input> | Basic text input |
email | <Input type="email"> | Email input with validation |
number | <Input type="number"> | Numeric input |
date | <Input type="date"> | Date picker |
datetime | <Input type="datetime-local"> | Date and time picker |
boolean | <Switch> | Toggle switch |
textarea | <Textarea> | Multi-line text |
select | <PicklistSelectRenderer> | Dropdown using picklist data |
lookup | <LookupFieldRenderer> | Entity reference selector |
Adding Select Fields with Picklists
To use a picklist for a select field, addpicklistName to the field definition:
Adding Lookup Fields
Lookup fields reference other entities. Configure them inLookupFieldRenderer.tsx:
Database Configuration
Field Configs Table (pf_entity_field_configs)
Each visible field needs a config entry:
Custom Fields
Custom fields are automatically included when:- They exist in
pf_custom_field_definitionsfor the entity type - A config entry exists with
field_source = 'custom'
Migration Example
Converting an existing form to ConfigurableForm:Before (Hardcoded)
After (ConfigurableForm)
Fallback Behavior
If no field configs exist for an entity/context, ConfigurableForm falls back to rendering all fields fromSTANDARD_FIELDS in a default layout.
Best Practices
- Seed field configs for all view contexts - create_form, edit_form, detail_view, list_view
- Use meaningful section names - Groups fields visually in the UI
- Set column_span = 2 for full-width fields like textarea
- Configure conditional_rules for dependent field visibility
- Use picklists instead of hardcoded select options for flexibility