Fields

Email Field

The email field renders an email-specific text input in the admin UI and stores its value as a string in Convex. It applies email validation styling and browser-native email input behavior. The underlying Convex validator is v.string(), wrapped in v.optional() when the field is not required.

Config options

OptionTypeDefaultDescription
requiredbooleanfalseMakes the field required in both the schema and the admin UI.
placeholderstring—Placeholder text shown when the input is empty.
readOnlybooleanfalseRenders the input as disabled.
labelstring | (data) => stringAuto-generatedCustom label for the admin UI.
descriptionstring—Help text displayed below the label.
conditionFieldCondition—Conditionally show or hide this field.
sidebarbooleanfalsePlace this field in the document sidebar.
listColumnbooleanfalseShow as a default column in list views.
searchablebooleanfalseIndex this field for full-text search.

Example usage

import { f, defineVextroCollection } from "vextro";

export const contacts = defineVextroCollection({
  slug: "contacts",
  label: "Contacts",
  collectionType: "content",
  tableName: "contacts",
  fields: {
    name: f.text({ required: true }),
    email: f.email({
      required: true,
      placeholder: "name@example.com",
      listColumn: true,
      searchable: true,
    }),
    alternateEmail: f.email({
      label: "Alternate Email",
      description: "Secondary contact email address.",
    }),
  },
});

Admin behavior

The email field renders as an <input type="email"> element, which enables native browser email validation and appropriate keyboard layout on mobile devices. The admin UI displays a validation error when the entered value does not match a valid email format.

Conditional display

invoiceEmail: f.email({
  required: true,
  placeholder: "billing@example.com",
  condition: { field: "sendInvoice", equals: true },
}),

When a condition is set, the field is always optional in the Convex schema regardless of the required setting. The required validation only applies when the field is visible.

Previous
Number
Next
URL