Skip to content
On this page

Configuration

The Auto Renderer is run by a configuration JSON or JavaScript object loaded at runtime. This guide details how to configure the auto-renderer.

Overview

The configuration object defines the auto-renderer's functionality, behavior, and appearance. All settings are centralized in this object for simplified management.

TypeScript Interface

typescript
/**
 * The configuration object for the FhirEngine.
 */
export interface EngineConfig {
  /**
   * Determines whether the application should automatically save form changes as they are made.
   */
  autoSave?: boolean

  autoSaveDelay?: number

  /**
   * An array of FHIR resources to be used within the application.
   */
  fhirResources?: r4.Resource[]

  /**
   * Determines the log level of the engine.
   */
  logLevel?: LogLevel

  /**
   * UI configuration for the fhir-renderer
   */
  ui?: {
    /**
     * The intended layout of the fhir-renderer.
     */
    layout?: RendererLayout
    /**
     * An object with key-value pairs, where the key is the language code and the value is an object with
     * label keys and translated label values.
     */
    customLabels?: {
      [labelCode: string]: {
        [languageIdentifier: string]: string
      }
    }
  }
}

Loading the Configuration

To configure the Visiontree Auto Renderer, create a JSON or TypeScript object with the settings. This object determines the auto-renderer's appearance and behavior. Load the configuration using the Core.loadConfig() method.

typescript
import { Core } from '@visiontree/mfx-auto-renderer'

Core.loadConfig({
  /// Configuration
})

TIP

The Core module is a singleton, and configurations can only be loaded once. If you need to change the configuration, you will need to reload the page.