Interface

WrapperTypeDefinition

@ng-forge/dynamic-forms

Configuration interface for registering wrapper types.

Defines how a wrapper component is loaded and identified. Wrapper components provide visual decoration around field content (sections, headers, styling) without affecting the form data structure.

Signature

interface WrapperTypeDefinition<
  T extends WrapperConfig = WrapperConfig
>

Type Parameters

NameConstraintDefaultDescription
TWrapperConfigWrapperConfig-

Properties

NameTypeDescription
wrapperName stringUnique identifier for the wrapper type (also serves as discriminant from FieldTypeDefinition)
_wrapper ?TWrapper definition type marker (internal use)
loadComponent LazyComponentLoader<unknown>

Function to load the wrapper component (supports lazy loading). Returns a Promise that resolves to the component class or module with default export.

types ?readonly string[]

Field types this wrapper should auto-apply to.

When a field's type matches any entry, the wrapper is injected into that field's effective wrapper chain at the lowest priority (can be overridden by FormConfig.defaultWrappers or the field-level wrappers array, and fully cleared with wrappers: null).

Examples

const SectionWrapper: WrapperTypeDefinition = {
  name: 'section',
  loadComponent: () => import('./section-wrapper.component').then(m => m.SectionWrapperComponent),
};