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.
The Composer class provides a programmatic way to build Forms.md forms using JavaScript. It generates the Forms.md template syntax from method calls, making it easier to create forms dynamically.
Constructor
Create a new Composer instance with optional settings.
const composer = new Composer ( settings );
Optional configuration object for the form or page. All properties are optional. When set to "all-slides", the first form field on each slide will be auto-focused when the slide becomes active
Primary color for buttons, form fields, etc. Must be HTML name, hex code, or RGB. Supports light/dark mode values
Text color on accent background. Must be HTML name, hex code, or RGB
Background color of the page. Must be HTML name, hex code, or RGB
Background image URL for the page
Logo image added to the header (must be valid Markdown image syntax)
buttonAlignment
'center' | 'end' | 'stretch'
Alignment of slide CTA buttons
Text color for the page. Must be HTML name, hex code, or RGB
colorScheme
'light' | 'dark'
default: "light"
Default color scheme
colorSchemeScope
'domain-wide' | 'isolate'
default: "domain-wide"
How color scheme preference is saved and applied
Show color scheme toggle button in footer
Prefix added to all CSS classes
Call to action link in header (must be valid Markdown link)
dir
'ltr' | 'rtl'
default: "ltr"
Text direction
URL to import custom fonts (valid CSS @import)
Adjust font size for the entire page
Character used to separate form field parameters
Control visibility of Forms.md branding
Use classic form field appearance
Control footer visibility
getFormat
'json' | 'csv' | 'tsv'
default: "json"
Format for reading data
Name used for objects when reading data
Control header visibility and alignment
Add anchor links to all headings
Identifier for the page or form
Make form field labels smaller
Language for automatic translation (e.g., “en”, “es”, “fr”)
page
'form-slides' | 'slides' | 'single'
default: "form-slides"
Page layout type
pageProgress
'hide' | 'show' | 'decorative'
Control page progress indicator
Control visibility of input placeholders
Google Sheets sheet name for saving responses
URL for sending form responses via POST
Control rounding of buttons and UI elements
Control visibility of next/previous buttons
Delimiter for creating new slides
Custom text for submit buttons
Align content to top of page
The generated template string. Access via composer.template
textInput()
Create a text input field.
composer . textInput ( 'name' , {
question: 'What is your name?' ,
required: true ,
placeholder: 'Enter your full name'
});
Field name used for form data
The main question for the form field
Extra information to help users fill out the form
Placeholder text for the input
Use textarea element for multi-line input
Maximum number of allowed characters
Regex pattern the input value must match
Make question and description smaller
Style as a subfield (smaller text)
Additional HTML attributes Conditional display logic Show displayCondition properties
Names of form fields or data used in the condition
Create an email input field with automatic validation.
composer . emailInput ( 'email' , {
question: 'What is your email?' ,
required: true
});
Parameters are the same as textInput() except multiline is not available.
Create a URL input field.
composer . urlInput ( 'website' , {
question: 'What is your website?' ,
placeholder: 'https://example.com'
});
Parameters are the same as textInput() except multiline is not available.
Create a telephone input field with country code selector.
composer . telInput ( 'phone' , {
question: 'What is your phone number?' ,
required: true ,
country: 'US' ,
availableCountries: [ 'US' , 'CA' , 'GB' ]
});
Default country code (e.g., “US”, “GB”, “FR”)
Array of available country codes
Other parameters are the same as textInput() except multiline is not available.
Create a password input field.
composer . passwordInput ( 'password' , {
question: 'Create a password' ,
required: true ,
minlength: 8
});
Parameters are the same as textInput() except multiline is not available.
Create a number input field.
composer . numberInput ( 'age' , {
question: 'What is your age?' ,
required: true ,
min: 18 ,
max: 120
});
Text displayed before the input (e.g., ”$”, ”€”)
Text displayed after the input (e.g., “kg”, ”%”)
selectBox()
Create a select dropdown field.
composer . selectBox ( 'country' , {
question: 'Select your country' ,
required: true ,
options: [
'United States' ,
'Canada' ,
{ label: 'United Kingdom' , value: 'UK' }
],
placeholder: 'Choose a country'
});
Array of options. Each option can be a string or an object with label and optional value
Placeholder text for the select
Pre-selected option value
Create a choice field with radio buttons or checkboxes.
composer . choiceInput ( 'interests' , {
question: 'What are your interests?' ,
choices: [ 'Reading' , 'Sports' , 'Music' , 'Travel' ],
multiple: true ,
horizontal: true
});
Array of choices. Each choice can be a string or an object with label and optional value
Allow multiple selections (uses checkboxes instead of radio buttons)
Display choices horizontally
Array of pre-checked choice values
pictureChoice()
Create a picture choice field.
composer . pictureChoice ( 'theme' , {
question: 'Choose your theme' ,
choices: [
{ label: 'Light' , value: 'light' , image: 'light.jpg' },
{ label: 'Dark' , value: 'dark' , image: 'dark.jpg' }
]
});
Array of picture choices. Each must have label, image URL, and optional value
Allow multiple selections
Array of pre-checked choice values
Create a rating input field.
composer . ratingInput ( 'satisfaction' , {
question: 'How satisfied are you?' ,
required: true ,
outOf: 5 ,
icon: 'star'
});
Number of rating options (1-10)
icon
'star' | 'heart' | 'hearts'
default: "star"
Icon to use for rating
Pre-selected rating value
opinionScale()
Create an opinion scale field.
composer . opinionScale ( 'likelihood' , {
question: 'How likely are you to recommend us?' ,
required: true ,
startAt: 0 ,
outOf: 10 ,
labelStart: 'Not likely' ,
labelEnd: 'Very likely'
});
Maximum scale value (5-10)
Label for the start of the scale
Label for the end of the scale
Create a datetime input field.
composer . datetimeInput ( 'appointment' , {
question: 'When would you like to schedule?' ,
required: true ,
min: '2024-01-01T09:00' ,
max: '2024-12-31T17:00'
});
Minimum datetime (format: “YYYY-MM-DDTHH:mm”)
Maximum datetime (format: “YYYY-MM-DDTHH:mm”)
Create a date input field.
composer . dateInput ( 'birthday' , {
question: 'What is your date of birth?' ,
required: true ,
max: '2024-12-31'
});
Minimum date (format: “YYYY-MM-DD”)
Maximum date (format: “YYYY-MM-DD”)
Create a time input field.
composer . timeInput ( 'meetingTime' , {
question: 'What time works best?' ,
required: true ,
min: '09:00' ,
max: '17:00'
});
Minimum time (format: “HH:mm”)
Maximum time (format: “HH:mm”)
Create a file upload field.
composer . fileInput ( 'resume' , {
question: 'Upload your resume' ,
required: true ,
sizeLimit: 5 ,
imageOnly: true
});
URL of existing file (for edit forms)
Slide Methods
slide()
Create a new slide.
composer . slide ({
jumpCondition: 'age >= 18' ,
pageProgress: '1/3' ,
post: true
});
Logic jump condition - slide only shown when condition is true
Custom progress indicator (e.g., “50%” or “1/2”)
buttonAlignment
'start' | 'center' | 'end' | 'stretch'
Alignment of this slide’s CTA button
Post form data when going to next slide
Disable the previous button on this slide
startSlide()
Create a start slide (first slide with a start button).
composer . startSlide ({
buttonText: 'Get Started' ,
buttonAlignment: 'center'
});
Custom text for the start button
buttonAlignment
'start' | 'center' | 'end' | 'stretch'
Alignment of the start button
endSlide()
Create an end slide (final slide after form submission).
composer . endSlide ({
redirectUrl: 'https://example.com/thank-you'
});
URL to redirect to from the end slide
Content Methods
dataBlock()
Create a data block to define variables.
composer . dataBlock ({
companyName: 'Acme Inc' ,
products: [ 'Widget' , 'Gadget' , 'Doohickey' ]
});
Object containing data to make available in the form
free()
Add free-form Markdown content.
composer . free ( '## Welcome \n\n Thank you for taking our survey!' );
p()
Create a paragraph.
composer . p ( 'This is a paragraph of text.' , {
id: 'intro' ,
classNames: [ 'highlight' ]
});
h1() - h6()
Create headings.
composer . h1 ( 'Main Title' );
composer . h2 ( 'Subtitle' , { id: 'subtitle' });
composer . h3 ( 'Section' );
Optional id, classNames, and attrs
ul()
Create an unordered list.
composer . ul ([
'First item' ,
'Second item' ,
'Third item'
]);
ol()
Create an ordered list.
composer . ol ([
'Step one' ,
'Step two' ,
'Step three'
]);
blockquote()
Create a blockquote.
composer . blockquote ( 'This is a quote. \n With multiple lines.' );
code()
Create a code block.
composer . code ( 'const x = 10; \n console.log(x);' , {
language: 'javascript'
});
Programming language for syntax highlighting
hr()
Create a horizontal rule.
div()
Create a div container.
composer . div ( 'Content inside div' , {
classNames: [ 'container' ],
bind: [ 'name' , 'email' ]
});
Array of form fields to bind for reactive updates
divStart() / divEnd()
Create div start and end tags separately.
composer . divStart ({ classNames: [ 'wrapper' ] });
composer . p ( 'Content' );
composer . divEnd ();
Example
import { Composer } from '@formsmd/composer' ;
const composer = new Composer ({
title: 'Customer Survey' ,
accent: 'blue'
});
composer . startSlide ();
composer . h1 ( 'Welcome!' );
composer . p ( 'Thank you for your time.' );
composer . slide ();
composer . textInput ( 'name' , {
question: 'What is your name?' ,
required: true
});
composer . emailInput ( 'email' , {
question: 'What is your email?' ,
required: true
});
composer . slide ();
composer . ratingInput ( 'satisfaction' , {
question: 'How satisfied are you?' ,
required: true ,
outOf: 5
});
composer . endSlide ();
composer . h2 ( 'Thank you!' );
composer . p ( 'We appreciate your feedback.' );
const template = composer . template ;