Skip to content

url

url<TCollectionSlug, TFieldKey, TFieldMeta>(options?): UrlField<TCollectionSlug, TFieldMeta>

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

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)
  • 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

UrlFieldInput<TCollectionSlug, TFieldKey, TFieldMeta>

URL field configuration. All properties are optional.

UrlField<TCollectionSlug, 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: 2048, index: "by_website" }),
// Social profile URL with a placeholder hint
twitterUrl: url({
required: false,
admin: { width: "50%", placeholder: "https://twitter.com/username" },
}),
}
})