select
select<
TFieldMeta>(options?):SelectField<TFieldMeta>
Defined in: packages/core/src/fields/select/config.ts:60
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—"full"admin.cellAlignment—"left"
Type Parameters
Section titled “Type Parameters”TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends BaseFieldMeta = BaseFieldMeta
Parameters
Section titled “Parameters”options?
Section titled “options?”SelectFieldInput<TFieldMeta>
Select field configuration. All properties are optional.
Returns
Section titled “Returns”SelectField<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 status: select({ required: true, options: [ { label: "Draft", value: "draft" }, { label: "Published", value: "published" }, ], }),
// 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