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 bydefineCollection)required—falseadmin.hidden—falseadmin.readOnly—falseadmin.position—"main"admin.width—"full"admin.cellAlignment—"left"
Type Parameters
Section titled “Type Parameters”TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends BaseFieldMeta = BaseFieldMeta
Parameters
Section titled “Parameters”options?
Section titled “options?”UrlFieldInput<TFieldMeta>
URL field configuration. All properties are optional.
Returns
Section titled “Returns”UrlField<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: { value: 2048 }, index: "by_website" }),
// Social profile URL with a placeholder hint twitterUrl: url({ required: false, admin: { width: "half", placeholder: "https://twitter.com/username" }, }), }})- UrlFieldInput for the full input type
- UrlField for the resolved output type