The configVar() function defines a standard (non-connection, non-data-source) config variable. Standard config variables hold primitive values — strings, numbers, booleans, schedules, lists, and more — that customers supply when deploying an instance. They are placed in the elements record of a configPage() .
Function signature
export const configVar = < T extends StandardConfigVar >(
definition : T ,
): T
Parameters
definition
StandardConfigVar
required
An object describing the config variable. The required fields depend on the dataType chosen. A unique, unchanging identifier for this config variable. Even if the variable’s key (its name in elements) changes, stableKey preserves the identity of the stored value in the platform.
dataType
ConfigVarDataType
required
The data type of this config variable. Determines the input control shown in the config wizard UI and the runtime value type. Value Runtime type Notes "string"stringPlain text input "date"stringDate picker (ISO format) "timestamp"stringDate-time picker (ISO format) "picklist"stringDropdown — requires pickList "code"stringCode editor — requires codeLanguage "boolean"booleanToggle switch "number"numberNumeric input "schedule"ScheduleCron schedule — optionally set timeZone "objectSelection"ObjectSelectionMulti-object selector "objectFieldMap"ObjectFieldMapField mapping UI "jsonForm"unknownJSON Form (requires schema) "htmlElement"stringRead-only HTML display element
Human-readable description shown to the user in the config wizard.
defaultValue
string | boolean | number | ...
Default value for this config variable. The accepted type matches the dataType. For "boolean" the value is a boolean; for "number" it is a number; for most others it is a string.
collectionType
'valuelist' | 'keyvaluelist'
When set, the config variable becomes multi-value. Not available for schedule, objectSelection, objectFieldMap, and jsonForm data types.
"valuelist" — An ordered list of values.
"keyvaluelist" — A list of key-value pairs.
permissionAndVisibilityType
'customer' | 'embedded' | 'organization'
default: "customer"
Controls who can view and edit this config variable in the config wizard.
"customer" — Customers can view and edit the value.
"embedded" — Customers cannot view or update; value is set programmatically.
"organization" — Customers cannot view or update; always uses the default value or is set by the organization.
Whether this config variable is visible to an organization deployer.
Show Type-specific fields
Required when dataType is "picklist". The list of selectable string values.
Required when dataType is "code". The syntax highlighting language for the code editor.
Optional timezone for dataType: "schedule" config variables (e.g., "America/New_York").
Validation mode for dataType: "jsonForm" config variables.
Return type
The same config variable definition object passed in, unchanged. The function is used for type inference.
Examples
String and boolean
Picklist
Code (JSON)
Value list (multi-value string)
Schedule
Organization-visible only
import { configVar } from "@prismatic-io/spectral" ;
const apiUrl = configVar ({
stableKey: "api-url" ,
dataType: "string" ,
description: "Base URL of the target API." ,
defaultValue: "https://api.example.com" ,
});
const debugMode = configVar ({
stableKey: "debug-mode" ,
dataType: "boolean" ,
description: "Enable verbose logging." ,
defaultValue: false ,
});