select
select<
TCollectionSlug,TFieldKey,TFieldMeta>(options?):SelectField<TCollectionSlug,TFieldMeta>
Defined in: packages/core/src/fields/select/config.ts:63
Creates a select field with all defaults applied.
Select fields store an array of chosen option values — suitable for status
labels, categories, tags, or any enumerable choice set. Set hasMany: false
to restrict to a single selection.
Accepts SelectFieldInput (all optional) and returns SelectField with all defaults applied.
Defaults applied:
label—""(inferred from the field key bydefineCollection)required—falsedefaultValue—[]options—[]hasMany—falseadmin.hidden—falseadmin.readOnly—falseadmin.position—"main"admin.width—"100%"admin.cellAlignment—"left"
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends string = string
TFieldKey
Section titled “TFieldKey”TFieldKey extends string = never
TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends BaseFieldMeta = BaseFieldMeta
Parameters
Section titled “Parameters”options?
Section titled “options?”SelectFieldInput<TCollectionSlug, TFieldKey, TFieldMeta>
Select field configuration. All properties are optional.
Returns
Section titled “Returns”SelectField<TCollectionSlug, TFieldMeta>
Resolved select field definition with all defaults applied.
Example
Section titled “Example”import { select, defineCollection } from '@vexcms/core'
posts: defineCollection({ fields: { // Single-select status field tier: select({ required: true, options: [ { label: "Free", value: "free" }, { label: "Pro", value: "pro" }, ], }),
// Multi-select tag field tags: select({ hasMany: true, options: [ { label: "News", value: "news" }, { label: "Tutorial", value: "tutorial" }, { label: "Release", value: "release" }, ], }), }})- SelectFieldInput for the full input type
- SelectField for the resolved output type