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 bydefineCollection)required—falseadmin.hidden—falseadmin.readOnly—falseadmin.position—"main"admin.width—"100%"admin.cellAlignment—"left"admin.mask— not set (opt-in; no project-wide default applies unless configured)
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends string = string
TFieldKey
Section titled “TFieldKey”TFieldKey extends string = never
TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends BaseFieldMeta = BaseFieldMeta
Parameters
Section titled “Parameters”options?
Section titled “options?”UrlFieldInput<TCollectionSlug, TFieldKey, TFieldMeta>
URL field configuration. All properties are optional.
Returns
Section titled “Returns”UrlField<TCollectionSlug, TFieldMeta>
Resolved URL field definition with all defaults applied.
Example
Section titled “Example”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" }, }), }})- UrlFieldInput for the full input type
- UrlField for the resolved output type