Skip to content

url

url<TFieldMeta>(options?): UrlField<TFieldMeta>

Defined in: packages/core/src/fields/url/config.ts:50

Creates a URL field with all defaults applied.

URL fields store absolute URLs as strings and render them as clickable links in the admin data table. Common uses: website links, canonical URLs, external resource references, social profile URLs.

Accepts UrlFieldInput (all optional) and returns UrlField with all defaults applied.

Defaults applied:

  • label"" (inferred from the field key by defineCollection)
  • requiredfalse
  • admin.hiddenfalse
  • admin.readOnlyfalse
  • admin.position"main"
  • admin.width"full"
  • admin.cellAlignment"left"

TFieldMeta extends BaseFieldMeta = BaseFieldMeta

UrlFieldInput<TFieldMeta>

URL field configuration. All properties are optional.

UrlField<TFieldMeta>

Resolved URL field definition with all defaults applied.

import { url, defineCollection } from '@vexcms/core'
pages: defineCollection({
fields: {
// Minimal — label inferred from key ("Canonical Url")
canonicalUrl: url(),
// Required website URL with a length cap and database index
website: url({ required: true, max: { value: 2048 }, index: "by_website" }),
// Social profile URL with a placeholder hint
twitterUrl: url({
required: false,
admin: { width: "half", placeholder: "https://twitter.com/username" },
}),
}
})