Skip to content

email

email<TCollectionSlug, TFieldKey, TFieldMeta>(options?): EmailField<TCollectionSlug, TFieldMeta>

Defined in: packages/core/src/fields/email/config.ts:47

Creates an email field with all defaults applied.

Email fields store single-line email address strings, format-checked in the admin form and on every server write. Common uses: contact emails, author emails, newsletter sign-ups.

Accepts EmailFieldInput (all optional) and returns EmailField with all defaults applied.

Defaults applied:

  • label — "" (inferred from the field key by defineCollection)
  • required — false
  • admin.hidden — false
  • admin.readOnly — false
  • admin.position — "main"
  • admin.width — "100%"
  • admin.cellAlignment — "left"
  • admin.mask — not set (opt-in; no project-wide default applies unless configured)

TCollectionSlug extends string = string

TFieldKey extends string = never

TFieldMeta extends BaseFieldMeta = BaseFieldMeta

EmailFieldInput<TCollectionSlug, TFieldKey, TFieldMeta>

Email field configuration. All properties are optional.

EmailField<TCollectionSlug, TFieldMeta>

Resolved email field definition with all defaults applied.

import { email, defineCollection } from '@vexcms/core'
authors: defineCollection({
fields: {
// Minimal — label inferred from key ("Contact Email")
contactEmail: email(),
// Required with a length cap and a database index
workEmail: email({ required: true, max: 254, index: "by_work_email" }),
}
})