Fields

URL Field

The URL field renders a URL-specific text input in the admin UI and stores its value as a string in Convex. It applies URL validation styling and browser-native URL input behavior. Use it for website links, API endpoints, social media profiles, and any field that should contain a valid URL. 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 companies = defineVextroCollection({
  slug: "companies",
  label: "Companies",
  collectionType: "content",
  tableName: "companies",
  fields: {
    name: f.text({ required: true }),
    website: f.url({
      placeholder: "https://example.com",
      listColumn: true,
    }),
    linkedIn: f.url({
      label: "LinkedIn",
      placeholder: "https://linkedin.com/company/...",
    }),
    apiEndpoint: f.url({
      label: "API Endpoint",
      readOnly: true,
      description: "Auto-generated webhook URL for this company.",
    }),
  },
});

Admin behavior

The URL field renders as an <input type="url"> element, which enables native browser URL validation. The admin UI displays a validation error when the entered value is not a well-formed URL. On mobile devices, the keyboard layout adjusts to include common URL characters like /, ., and :.

Conditional display

externalUrl: f.url({
  required: true,
  placeholder: "https://...",
  condition: { field: "linkType", equals: "external" },
}),

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
Email
Next
Slug