MatFormConfig
@ng-forge/dynamic-forms-material
Material-specific FormConfig with type-safe defaultProps.
Use this type alias when defining form configurations with Material Design components
to get IDE autocomplete and type checking for defaultProps.
Signature
type MatFormConfig<
TFields extends NarrowFields | RegisteredFieldTypes[] = RegisteredFieldTypes[],
TValue = InferFormValue<TFields extends readonly RegisteredFieldTypes[] ? TFields : RegisteredFieldTypes[]>,
> = FormConfig<TFields, TValue, MatFormProps>;Type Parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
TFields | NarrowFields | RegisteredFieldTypes[] | RegisteredFieldTypes[] | - |
TValue | - | InferFormValue<TFields> | - |
Properties
| Name | Type | Description |
|---|---|---|
fields | TFields | Array of field definitions that define the form structure. Fields are rendered in the order they appear in this array. Supports nested groups and conditional field visibility. |
schema ? | FormSchema<unknown> | Optional form-level validation schema using Standard Schema spec. Provides additional validation beyond field-level validation. Supports Zod, Valibot, ArkType, and other Standard Schema compliant libraries. Useful for cross-field validation rules. |
options ? | FormOptions | Global form configuration options. Controls form-wide behavior like validation timing and disabled state. @value {} |
schemas ? | SchemaDefinition[] | Global schemas available to all fields. Reusable validation schemas that can be referenced by field definitions. Promotes consistency and reduces duplication. |
defaultValidationMessages ? | ValidationMessages | Form-level validation messages that act as fallback for field-level messages. These messages are used when a field has validation errors but no
field-level |
customFnConfig ? | CustomFnConfig<TValue> | Signal forms adapter configuration. |
submission ? | SubmissionConfig<TValue> | Form submission configuration. When provided, enables integration with Angular Signal Forms' native While the submission action is executing, Server errors returned from the action will be automatically applied to the corresponding form fields. |
defaultProps ? | MaterialConfig | Default props applied to all fields in the form. These props serve as defaults that can be overridden at the field level. Useful for setting consistent styling across the entire form (e.g., appearance, size, or other UI library-specific props). The cascade order is: Library config → Form defaultProps → Field props Each level can override the previous one. |
externalData ? | Record<string, Signal<unknown>> | External data signals available to conditional logic and derivations. Provides a way to inject external application state into form expressions.
Each property is a Signal that will be unwrapped and made available in the
The signals are read reactively in logic functions (when/readonly/disabled) so changes to the external data will trigger re-evaluation of conditions. |
defaultWrappers ? | readonly WrapperConfig[] | Form-wide default wrappers applied to every field that does not explicitly opt out. Merged into a field's effective wrapper chain between auto-associated wrappers
(outermost) and field-level |
Examples
const formConfig: MatFormConfig = {
defaultProps: {
appearance: 'outline',
subscriptSizing: 'dynamic',
},
fields: [
{ type: 'mat-input', key: 'name', label: 'Name' }, // Uses form defaultProps
{ type: 'mat-input', key: 'email', props: { appearance: 'fill' } }, // Override
],
};packages/dynamic-forms-material/src/lib/types/form-config.ts:48