Link

The Link Field stores a URL and label pair. Used for buttons, navigation links, or external references.

Installation

Included in Headcode CMS Starter, no setup needed.

Usage

heroSection.tsx
export const heroSection = {  name: 'hero',  label: 'Hero Section',  fields: {    primaryButton: LinkField({      label: 'Primary Button',    }),  },};

Options

heroSection.tsx
LinkField({  label: 'Learn more link',  defaultValue: {    title: 'Get Started',    url: '/docs',    openInNewWindow: false,  },  validator: z.object({    title: z.string().min(5),    url: z.string(),    // url: z.url(),    openInNewWindow: z.boolean().default(false),  }),});