URL
A link field that stores a structured link object for external URLs or internal document references.
The url field stores a link. It can hold a plain external URL or a reference to another document in your project, and it returns a structured object rather than a bare string — the link type, the resolved url, and, for internal links, the relationTo collection, the target value, and a label.
For internal links, set the target collection's admin.urlPattern (for example /blog/{slug}) so Dyrected can build the resolved path. urlPattern is a convenience for producing frontend URLs; it does not change your API routes. Like other text-based fields, url accepts an advisory maxLength.
defineUrlField({ name: 'ctaLink', label: 'Call to action link' })Making the link clickable
Set admin.format to 'link' and the url renders as a clickable link in the admin list, so you can open the destination straight from the table:
defineUrlField({ name: 'website', label: 'Website', admin: { format: 'link' } })Links open in a new tab by default; pass { type: 'link', newTab: false } to open in the same tab instead. This changes only how the value displays, not what's stored.
Generated reference
The contract below is generated from the public @dyrected/core exports by @dyrected/knowledge, so it stays in sync with the package. See Fields for the shared field options every type accepts.
LinkFormat
How a url or email value is presented in read-only Admin surfaces.
Renders the value as a clickable link (a mailto: link for email) instead
of plain text. Display only.
export type LinkFormat =
/** Shorthand for `{ type: "link" }`. */
| "link"
| {
type: "link";
/** Open the link in a new tab. Defaults to `true`. */
newTab?: boolean;
};UrlField
Exported type from @dyrected/core.
export type UrlField = TypedField<"url", string | UrlLinkValue, UrlFieldAdmin> &
CharacterLimitFieldConfig;UrlFieldAdmin
Exported type from @dyrected/core.
export type UrlFieldAdmin = CharacterLimitFieldAdmin & {
/** How the value is displayed in read-only Admin surfaces. Does not affect storage or editing. */
format?: LinkFormat;
};UrlLinkValue
Exported interface from @dyrected/core.
export interface UrlLinkValue {
/** Whether the link is a custom URL or a reference to an internal document. */
type: "custom" | "internal";
/** The link URL. Absolute for custom links; may be a site-relative path for internal links. */
url?: string;
/** For internal links, the collection slug of the referenced document. */
relationTo?: string;
/** For internal links, the ID of the referenced document. */
value?: string;
/** Optional display label shown for the link. */
label?: string;
}| Option | Description |
|---|---|
type (required) | Whether the link is a custom URL or a reference to an internal document. |
url (optional) | The link URL. Absolute for custom links; may be a site-relative path for internal links. |
relationTo (optional) | For internal links, the collection slug of the referenced document. |
value (optional) | For internal links, the ID of the referenced document. |
label (optional) | Optional display label shown for the link. |