checkbox
checkbox<
TFieldMeta>(options?):CheckboxField<TFieldMeta>
Defined in: packages/core/src/fields/checkbox/config.ts:47
Creates a checkbox field with all defaults applied.
Checkbox fields store boolean values — feature flags, opt-in toggles, published states, visibility flags, and similar on/off settings.
Accepts CheckboxFieldInput (all optional) and returns CheckboxField with all defaults applied.
Defaults applied:
label—""(inferred from the field key bydefineCollection)required—falsedefaultValue—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?”CheckboxFieldInput<TFieldMeta>
Checkbox field configuration. All properties are optional.
Returns
Section titled “Returns”CheckboxField<TFieldMeta>
Resolved checkbox field definition with all defaults applied.
Example
Section titled “Example”import { checkbox, defineCollection } from '@vexcms/core'
posts: defineCollection({ fields: { // Minimal — label inferred from key ("Published") published: checkbox(),
// Required field, checked by default when creating a new document featured: checkbox({ defaultValue: true, admin: { width: "half" } }),
// Indexed flag for fast admin queries archived: checkbox({ index: "by_archived" }), }})- CheckboxFieldInput for the full input type
- CheckboxField for the resolved output type