Skip to content

GlobalConfigInput

Defined in: packages/core/src/globals/types.ts:145

User-facing input to defineGlobal().

Mirrors CollectionConfigInput with the same five generics. The constraint [TFieldSlug & ReservedGlobalFieldKey] extends [never] is enforced in defineGlobal’s function signature — a compile-time error is emitted if any field key is _id, _creationTime, or _slug.

TFieldSlug

Union of field key string literals.

defineGlobal({
slug: "siteSettings",
label: "Site Settings",
fields: {
siteName: text({ label: "Site Name", required: true }),
activeTheme: relationship({ label: "Active Theme", collection: "themes" }),
},
admin: { group: "Site Builder" },
});

TFieldMeta extends object = { }

Metadata attached to each field definition.

TGlobalMeta extends object = { }

Metadata attached to the global config itself.

TGlobalSlug extends string = string

The slug string literal type (inferred by defineGlobal).

TFields extends Record<string, AdminField<TFieldMeta>> = Record<string, AdminField<TFieldMeta>>

TComponent extends ComponentHKT = ComponentHKT

Component HKT binding.

TDrafts extends boolean = false

optional admin?: GlobalAdminConfigInput<TComponent, TGlobalSlug extends string ? TGlobalSlug : string, false>

Defined in: packages/core/src/globals/types.ts:176

Admin panel display and behaviour config.


fields: TFields

Defined in: packages/core/src/globals/types.ts:170

Field definitions for this global. All field types supported by defineCollection are valid. Field keys must not be _id, _creationTime, or _slug (enforced at compile time by defineGlobal).


optional hooks?: GlobalHooksInput<TGlobalSlug extends string ? TGlobalSlug : string>

Defined in: packages/core/src/globals/types.ts:172

Lifecycle hooks for this global.


optional interfaceName?: string

Defined in: packages/core/src/globals/types.ts:184

Override the generated TypeScript interface name. Inferred from slug with Global suffix when omitted (e.g. "siteSettings" → "SiteSettingsGlobal").


label: string

Defined in: packages/core/src/globals/types.ts:164

Human-readable label shown in the admin sidebar and page heading. Always used as the admin page title — globals have no useAsTitle.

"Site Settings"

optional meta?: TGlobalMeta

Defined in: packages/core/src/globals/types.ts:186

Arbitrary metadata attached to this global config.


slug: TGlobalSlug

Defined in: packages/core/src/globals/types.ts:158

Unique slug for this global. Becomes the _slug discriminator on the flat document and the lookup key in vex_globals. Must be camelCase and unique across all globals in the project.


optional versions?: object

Defined in: packages/core/src/globals/types.ts:192

Draft and versioning config. Parsed but ignored in v35 — versioning for globals lands in Spec 36. Included now for forward compatibility so defineGlobal call sites don’t need to change when Spec 36 ships.

optional autosave?: object

Debounce background saves to the draft row while the edit form is open. Ignored when drafts is false.

false

optional debounceMs?: number

Debounce (milliseconds) to autosave after inputs have changed

enabled: boolean

Enable or disable autosaves to new drafts

optional drafts?: TDrafts

Enable the draft/publish workflow for this collection.

false