String
Use x.string() for text values. Supports format validators like .email(), .url(), and length constraints.
x.string().label("Company Name").min(2).max(100)columnNameAliases
Use alternate CSV headers for the same field.
.columnNameAliases(aliases: string[])
aliaseslists the alternate column names, e.g.,["Email", "Email Address"].
label
Sets the user-facing label shown in the widget.
.label(text: string)
textsets the label text.
description
Sets help text shown below the field.
.description(text: string)
textsets the description text.
example
Sets the placeholder example value.
.example(text: string)
textsets the example value.
optional
Makes the field optional.
.optional()
default
Available after .optional().
.default(defaultValue: unknown | (() => unknown | Promise<unknown>))
defaultValuecan be a static value or a function used when the field is empty, e.g.,"Unknown"or() => new Date().toISOString().
Validates email format.
.email(options?: { message?: string })
messageoverrides the validation error text, e.g.,"Enter a valid email address".
url
Validates URLs.
.url(options?: { allowedProtocols?: ("http" | "https" | "ftp" | "sftp" | "file" | "mailto" | "tel")[]; allowedDomains?: string[]; allowSubdomains?: boolean; allowPaths?: boolean; allowQueryParams?: boolean; message?: string })
allowedProtocolsrestricts accepted protocols, e.g.,["https"]or["https", "mailto"].allowedDomainsrestricts accepted domains, e.g.,["example.com"].allowSubdomainscontrols whether subdomains are accepted.allowPathscontrols whether paths are accepted.allowQueryParamscontrols whether query strings are accepted.messageoverrides the validation error text, e.g.,"Only company URLs are allowed".
uuid
Validates UUIDs.
.uuid(options?: { version?: "v1" | "v4" | "v5" | "all"; message?: string })
versionrestricts the accepted UUID version, e.g.,"v4"or"all".messageoverrides the validation error text, e.g.,"Use a valid UUID".
ip
Validates IP addresses.
.ip(options?: { version?: "v4" | "v6" | "all"; message?: string })
versionrestricts the accepted IP version, e.g.,"v4","v6", or"all".messageoverrides the validation error text, e.g.,"Enter a valid IP address".
phone
Validates phone numbers.
.phone(options?: { allowedCountries?: string[]; format?: "international" | "national" | "both"; output?: "e164" | "formatted" | "digits"; message?: string })
allowedCountriesrestricts input to ISO 3166-1 alpha-2 country codes, e.g.,["US"]or["US", "CA"].formatcontrols the expected input format, e.g.,"international","national", or"both".outputcontrols the normalized output format, e.g.,"e164","formatted", or"digits".messageoverrides the validation error text, e.g.,"Enter a valid US phone number".
country
Validates country names or codes.
.country(options?: { output?: "name" | "2-letter" | "3-letter"; message?: string })
outputcontrols the parsed country format, e.g.,"name","2-letter", or"3-letter".messageoverrides the validation error text, e.g.,"Enter a valid country".
alphabetical
Restricts values to letters only.
.alphabetical(options?: { message?: string })
messageoverrides the validation error text, e.g.,"Use letters only".
alphanumerical
Restricts values to letters and numbers only.
.alphanumerical(options?: { message?: string })
messageoverrides the validation error text, e.g.,"Use letters and numbers only".
numerical
Restricts values to numeric characters only.
.numerical(options?: { message?: string })
messageoverrides the validation error text, e.g.,"Use numeric characters only".
regex
Matches a regular expression.
.regex(pattern: RegExp, options?: { message?: string })
patternis the regular expression to match, e.g.,/^[A-Z]{3}-\d{4}$/.messageoverrides the validation error text, e.g.,"Use format ABC-1234".
iban
Validates IBAN values.
.iban(options?: { allowedCountries?: string[]; message?: string })
allowedCountriesrestricts input to ISO 3166-1 alpha-2 country codes, e.g.,["DE"]or["DE", "FR"].messageoverrides the validation error text, e.g.,"Enter a valid EU IBAN".
bic
Validates BIC/SWIFT codes.
.bic(options?: { message?: string })
messageoverrides the validation error text, e.g.,"Enter a valid BIC/SWIFT code".
gtin
Validates GTIN values.
.gtin(options?: { message?: string })
messageoverrides the validation error text, e.g.,"Enter a valid GTIN".
currencyCode
Validates ISO 4217 currency codes.
.currencyCode(options?: { allowedCurrencies?: string[]; message?: string })
allowedCurrenciesrestricts input to specific currency codes, e.g.,["USD"]or["USD", "EUR"].messageoverrides the validation error text, e.g.,"Use a supported currency code".
min
Sets the minimum length.
.min(minLength: number, options?: { message?: string })
minLengthsets the minimum length.messageoverrides the validation error text, e.g.,"Must be at least 8 characters".
max
Sets the maximum length.
.max(maxLength: number, options?: { message?: string })
maxLengthsets the maximum length.messageoverrides the validation error text, e.g.,"Must be 255 characters or fewer".
length
Sets the required exact length.
.length(exactLength: number, options?: { message?: string })
exactLengthsets the required exact length.messageoverrides the validation error text, e.g.,"Must be exactly 2 characters".
includes
Requires a substring.
.includes(substring: string, options?: { message?: string })
substringsets the required substring.messageoverrides the validation error text, e.g.,"Must include @".
startsWith
Requires a prefix.
.startsWith(prefix: string, options?: { message?: string })
prefixsets the required prefix.messageoverrides the validation error text, e.g.,"Must start with INV-".
endsWith
Requires a suffix.
.endsWith(suffix: string, options?: { message?: string })
suffixsets the required suffix.messageoverrides the validation error text, e.g.,"Must end with .com".