Function
withCustomAddon
@ng-forge/dynamic-forms
Register a custom addon kind with the form.
The provided definition is added to ADDON_KIND_REGISTRY"> at form
initialisation, alongside the built-in ADDON_KIND_REGISTRYtext / template / component
kinds and any kinds contributed by adapter feature helpers
( etc.).withPrimeNGAddons()
Signature
function withCustomAddon<
T extends BaseAddon
>(definition: AddonKindDefinition<T>): DynamicFormFeature<"addons">Type Parameters
| Name | Constraint | Default | Description |
|---|---|---|---|
T | BaseAddon | - | - |
Parameters
| Name | Type | Description |
|---|---|---|
definition | AddonKindDefinition<T> | - |
Returns
DynamicFormFeature<"addons">
Examples
provideDynamicForm(
...withMaterialFields(),
withCustomAddon({
kind: 'lucide-icon',
// Match how field types register: a default-exported component lets
// `loadComponent` return the import promise directly.
loadComponent: () => import('./lucide-icon-addon.component'),
validate: (addon) => {
if (typeof addon.icon !== 'string') {
throw new Error('lucide-icon: icon string is required');
}
},
}),
);packages/dynamic-forms/src/lib/providers/features/addons/with-custom-addon.ts:35