Configuration
Configure application-specific networking and translations outside the portable schema.
A complete configuration
const config = {
apis: {
backend: {
baseUrl: 'https://api.example.com/v1/',
headers: (context) => ({ Authorization: 'Bearer ' + getToken() }),
credentials: 'same-origin',
timeoutMs: 30000,
},
},
i18n: {
translations: { en: '/locales/en.json', sk: '/locales/sk.json' },
fallbackLanguage: 'en',
// Alternatively supply directory: '/locales'.
},
// Optional: request: yourRequestExecutor
}API settings
| Property | Meaning / default |
|---|---|
apis | Named API definitions referenced by data sources and file uploads. No APIs are configured by default. |
baseUrl | Required HTTP(S) base path, without embedded credentials, query, or fragment. |
headers | Optional HeadersInit or synchronous/asynchronous function of request context. Evaluated per request. |
credentials | Fetch credentials policy; defaults to omit. |
timeoutMs | Positive finite timeout, default 30,000 ms. Includes request execution and aborts on expiry. |
request | Optional executor override for the shared API layer. Receives a normalized request and returns a data envelope. |
Endpoint definitions use a relative endpoint beneath their API base path and optionally a method. Absolute URLs and path escapes are rejected. Data-source requests default to GET; uploads default to POST. Put credentials in config or your request override, never in an exported schema.
Translation settings
| Property | Meaning / default |
|---|---|
i18n.translations | A map of language to imported JSON catalog or browser-accessible JSON URL. |
i18n.directory | Alternative catalog directory URL. Loads the language.json file. |
i18n.fallbackLanguage | Fallback catalog language; defaults to en. Bundled English remains the final system-text fallback. |
language | A per-form/editor prop, not global config. Defaults to inherited language or en. |
Translation loading uses the request executor with context.operation = 'i18n', without inheriting application API headers or credentials. Literal schema strings use lookup and fallback. See Localization for plural forms, parameters, loading failures, and reload.
Form instance props
| Prop | Purpose |
|---|---|
schema | Required Tungsten schema (schemaVersion: sprout). |
onSubmit | Required callback for validated meaningful values; may return a Promise. |
initialValues | Optional value object or null for schema/type defaults. |
config / dataSources | API/translation configuration and named data-source definitions. |
design | Optional Tungsten, Bootstrap or custom design; defaults to Tungsten. |
language | Per-instance presentation language. |
colorScheme | Light or dark; inherits TungstenThemeProvider, otherwise light. Theme changes preserve form state. |
colorProfile | Named CSS palette; inherits TungstenThemeProvider, otherwise sprout. Custom names require application CSS. |
onStateChange | Completed schema/state/values/valid snapshot callback, including invalid data. |
onReady | Receives the controller for reset, value loading and file preparation. |
const config = {
maxProcessingSteps: 100, // Increase for intentionally broad cascades.
warnings: 'console', // 'silent' mutes warning logs, not callback delivery.
}
<Tungsten schema={schema} config={config}
onDiagnostic={({ severity, messageKey, params, message }) => {
console.log(severity, messageKey, params, message)
}}
onReady={controller => { /* controller.reset() restores initial values */ }} />Configuration boundaries
Configure autosave and submission endpoints, or handle their promises in your application. Angular, material and custom display formats remain future work.