dynamic-forms / Variable

FORM_OPTIONS

Injection token for form-level options.

Form options control form-wide behavior including button disabled states. Used by button mappers to determine default disabled behavior.

Like DEFAULT_PROPS, this token is provided ONCE at the DynamicForm level and inherited by all children via Angular's hierarchical injector.

The token provides a Signal to enable reactivity - when config changes, mappers that read the signal inside their computed() will automatically update.

Presentation

const FORM_OPTIONS: InjectionToken<Signal<FormOptions | undefined>>;

Example usage

// In a button mapper
const formOptionsSignal = inject(FORM_OPTIONS);

return computed(() => {
  const formOptions = formOptionsSignal?.();  // Read inside computed for reactivity
  const disableWhenInvalid = formOptions?.submitButton?.disableWhenInvalid ?? true;
  // ...
});