Skip to content

defineOptions

connector.defineOptions(fn)

Used to define the configuration options that your connector will expose in the Netlify UI.

Takes a function with an object as a parameter. The object contains the following property:

ParameterDescription
zodUse to create and return a Zod object that contains your options. Supported options are outlined below.

Learn more about configuring options for the Netlify UI.

Supported option methods

Netlify supports the following methods:

MethodDescription
{option_type}Define the option’s type using the related Zod method.
meta()Define metadata to customize the UI that will appear in the Netlify UI.
optional()(optional) Marks the field as optional.

Option type

zod.{option_type}()

Define the option’s type using the related Zod method, for example zod.string().

Supports object(), string(), number(), and boolean(). Arrays are not supported.

meta

zod.{option_type}().meta()

Set the metadata for the option by passing an object with the following properties:

PropertyDescription
labelString representing the label to use for the form field.
helpText(optional) String representing the help text to display with the form field that helps users understand what value to enter.
secret(optional) Boolean. Set this to true to mark a field as secret and Netlify will mask the user’s value in the Netlify UI.

optional

zod.{option_type}().optional()

Marks the field as optional when called. No parameters required.

Usage example

// Defins a required `API token` string field that masks the user’s value
// and defines an optional `Page limit` string field
connector.defineOptions(({ zod }) => {
return zod.object({
apiToken: zod.string().meta({
label: "API token",
helpText: "The delivery API token for your environment",
secret: true,
}),
pageLimit: zod.string().optional().meta({
label: "Page limit",
helpText: "The number of entries to fetch per page when syncing data",
}),
});
});

Got it!

Your feedback helps us improve our docs.