Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/formsmd/formsmd/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The telInput method creates a telephone input field with automatic country code selection and formatting. It supports international phone numbers with country-specific placeholders and validation.

Method Signature

telInput(
  name: string,
  params: FormFieldSharedParamsType & TelInputParamsType
): string

Parameters

name
string
required
The unique identifier for this input field. Used to reference the phone number in form submissions.

Required Parameters

question
string
required
The main question or label displayed to the user.

Input-Specific Parameters

placeholder
string
Sets custom placeholder text. If not provided, a country-specific placeholder is automatically generated.
placeholder: "(555) 123-4567"
country
CountryCodeType
Default country code (2-letter ISO code). Defaults to "US" if not specified.
country: "GB"  // United Kingdom
See Country Codes for the full list of supported countries.
availableCountries
CountryCodeType[]
Array of country codes to allow. If provided, only these countries will be available in the country selector.
availableCountries: ["US", "CA", "GB", "AU"]
maxlength
number
Maximum number of allowed characters in the phone number input.
maxlength: 15
pattern
string
Custom regex pattern for phone number validation.
pattern: "^\\d{10}$"  // Exactly 10 digits
value
string
Default phone number value.
value: "555-123-4567"

Shared Parameters

All standard form field parameters are supported. See textInput for the complete list including required, description, fieldSize, disabled, and more.

Examples

const composer = new Composer({ title: "Contact Form" });

composer.telInput("phone", {
  question: "What is your phone number?",
  required: true,
  country: "US"
});

Features

The telephone input automatically includes a country selector showing:
  • Country flag
  • Country calling code (e.g., +1, +44)
  • Country name
composer.telInput("phone", {
  question: "Phone number",
  country: "US",  // Default to United States
  availableCountries: ["US", "CA", "MX"]  // North America
});
Users can click the country selector to choose a different country from the available options.

Country Codes

Most frequently used country codes:
CodeCountryCalling Code
USUnited States+1
CACanada+1
GBUnited Kingdom+44
AUAustralia+61
DEGermany+49
FRFrance+33
ITItaly+39
ESSpain+34
NLNetherlands+31
CNChina+86
JPJapan+81
INIndia+91
The telInput method supports over 200 countries and territories. Some examples:
  • North America: US, CA, MX
  • Europe: GB, DE, FR, IT, ES, NL, SE, NO, DK, FI
  • Asia: CN, JP, IN, KR, SG, TH, VN
  • Oceania: AU, NZ
  • South America: BR, AR, CL, CO
  • Africa: ZA, EG, NG, KE
For the complete list, see the TypeScript definitions in the source code.
Common regional groupings:
// North America
availableCountries: ["US", "CA", "MX"]

// European Union (sample)
availableCountries: ["DE", "FR", "IT", "ES", "NL", "BE"]

// English-speaking
availableCountries: ["US", "GB", "CA", "AU", "NZ", "IE"]

// Nordic countries
availableCountries: ["SE", "NO", "DK", "FI", "IS"]

Use Cases

Contact Forms

Collect phone numbers from customers for follow-up.

User Registration

Get phone numbers for account verification via SMS.

Delivery Information

Collect phone numbers for delivery coordination.

International Support

Support customers from multiple countries.

Best Practices

Choose the most relevant default country for your audience:
// For US-based business
country: "US"

// For UK-based business
country: "GB"

// For international business (detect from IP or browser)
country: getUserCountry()  // Implement based on your needs
If you only operate in specific regions, limit the country list:
composer.telInput("phone", {
  question: "Phone number",
  country: "US",
  availableCountries: ["US", "CA"],
  description: "We currently only serve US and Canada"
});
Use descriptions to clarify expectations:
description: "Include country code if outside the US"
description: "We'll use this number for delivery updates"
description: "SMS verification will be sent to this number"
Add pattern validation for strict requirements:
// US only: exactly 10 digits
pattern: "^[0-9]{10}$",
availableCountries: ["US"],
description: "10-digit US phone number"

// International: allow varying lengths
// No pattern needed, default validation handles it

Validation

Phone number validation varies by country. The input uses the HTML5 tel type with optional pattern validation.
// Basic validation (any phone format)
composer.telInput("phone", {
  question: "Phone number",
  required: true
});

// Strict US validation
composer.telInput("usPhone", {
  question: "US phone number",
  required: true,
  country: "US",
  availableCountries: ["US"],
  pattern: "^[0-9]{10}$",
  description: "10 digits, no spaces or dashes"
});

// International with length limit
composer.telInput("intlPhone", {
  question: "International phone",
  required: true,
  maxlength: 15,
  description: "Maximum 15 digits"
});

Return Value

Returns a string containing the Forms.md markup for the telephone input field. Submitted value format: The calling code and phone number, e.g., "+1 555-123-4567"

textInput

General text input for non-phone text

emailInput

Email input with validation

numberInput

Numeric input for phone extensions