Skip to content

SelectFieldInput

Defined in: packages/core/src/fields/select/types.ts:53

Configuration input for a select() field.

Select fields store an array of chosen option values — status labels, categories, tags, or any enumerable set. All properties are optional; unset properties fall back to the defaults listed below.

Defaults applied by select():

{
type: "select",
label: "", // inferred from the field key by defineCollection
required: false, // field is optional by default
defaultValue: [], // empty selection
options: [], // no options configured
hasMany: false, // single-select by default
admin: {
hidden: false, // visible in the admin form
readOnly: false, // editable by default
position: "main", // placed in the main content column, not the sidebar
width: "full", // spans the full form width, not half
cellAlignment: "left", // aligned left in the data table column
}
}
// Single-select status
status: select({
required: true,
options: [
{ label: "Draft", value: "draft" },
{ label: "Published", value: "published" },
],
})
// Multi-select tags with badge colours
tags: select({
hasMany: true,
options: [
{ label: "News", value: "news", badgeColor: "#3b82f6" },
{ label: "Tutorial", value: "tutorial", badgeColor: "#10b981" },
],
})

BaseFieldInput for shared properties (label, description, required, admin, index)

TFieldMeta extends object = { }

optional admin?: FieldAdminConfigInput

Defined in: packages/core/src/fields/baseTypes.ts:209

Admin UI configuration for this field.

BaseFieldInput.admin


optional defaultValue?: string[]

Defined in: packages/core/src/fields/select/types.ts:61

Pre-filled value shown in the admin form when creating a new field. Does not apply to database values

BaseFieldInput.defaultValue


optional description?: string

Defined in: packages/core/src/fields/baseTypes.ts:194

Semantic description of the field. Used in three places:

  1. Helper text rendered below the field input in the admin form UI.
  2. As the Zod .meta({ description }) value for form validation.
  3. As the JSDoc comment on the generated document interface property.

To write a separate JSDoc comment, use interfaceDescription in addition.

BaseFieldInput.description


optional hasMany?: boolean

Defined in: packages/core/src/fields/select/types.ts:67


optional index?: string

Defined in: packages/core/src/fields/baseTypes.ts:220

Create a database index on this field. The string value becomes the index name in Convex.

slug: { type: "text", index: "by_slug", required: true }
// Generates: .index("by_slug", ["slug"])

BaseFieldInput.index


optional interfaceDescription?: string

Defined in: packages/core/src/fields/baseTypes.ts:196

The JSDoc comment on the generated document interface property

BaseFieldInput.interfaceDescription


optional label?: string

Defined in: packages/core/src/fields/baseTypes.ts:185

Display label for the field in the admin form.

BaseFieldInput.label


optional meta?: TFieldMeta

Defined in: packages/core/src/fields/baseTypes.ts:221

BaseFieldInput.meta


optional optionInterfaceName?: string

Defined in: packages/core/src/fields/select/types.ts:68


optional options?: object[]

Defined in: packages/core/src/fields/select/types.ts:62

optional badgeColor?: string

label: string

value: string


optional required?: boolean

Defined in: packages/core/src/fields/baseTypes.ts:202

Whether this field is required.

Default: false

BaseFieldInput.required