Fields

Textarea Field

The textarea field renders a multi-line text input in the admin UI and stores its value as a string in Convex. Use it for descriptions, summaries, notes, and any content that benefits from multiple lines of input. 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.
rowsnumber—Number of visible text rows for the textarea element.
placeholderstring—Placeholder text shown when the input is empty.
readOnlybooleanfalseRenders the textarea 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 articles = defineVextroCollection({
  slug: "articles",
  label: "Articles",
  collectionType: "content",
  tableName: "articles",
  fields: {
    title: f.text({ required: true }),
    excerpt: f.textarea({
      rows: 3,
      placeholder: "Brief summary of the article...",
      searchable: true,
      description: "Shown in search results and social cards.",
    }),
    internalNotes: f.textarea({
      rows: 6,
      label: "Internal Notes",
      description: "Not visible to the public.",
    }),
  },
});

Admin behavior

The textarea field renders as a standard <textarea> element. The rows option controls the initial visible height. The textarea is resizable by default in the admin UI, so rows sets the starting size rather than a fixed height.

Conditional display

rejectionReason: f.textarea({
  rows: 4,
  required: true,
  placeholder: "Explain why this was rejected...",
  condition: { field: "status", equals: "rejected" },
}),

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
Text
Next
Number