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 choiceInput method creates radio button inputs for single selections or checkbox inputs for multiple selections. It provides a clean interface for users to choose from a predefined set of options.

Method Signature

choiceInput(
  name: string,
  params: FormFieldSharedParamsType & ChoiceInputParamsType
): string

Parameters

name
string
required
The unique identifier for this input field. Used to reference the selected value(s) in form submissions.

Required Parameters

question
string
required
The main question or label displayed to the user.
choices
(string | ChoiceOptionType)[]
required
Array of choices as strings or objects with label and value properties.
// Simple string array
choices: ["Option A", "Option B", "Option C"]

// With custom values
choices: [
  { label: "Option A", value: "a" },
  { label: "Option B", value: "b" }
]

Input-Specific Parameters

multiple
boolean
When set to true, allows multiple selections using checkboxes instead of radio buttons.
multiple: true
horizontal
boolean
When set to true, displays choices horizontally instead of vertically.
horizontal: true
hideFormText
boolean
When set to true, hides the question and description, showing only the choices.
hideFormText: true
checked
string[]
Array of pre-checked choice values (must match the value property).
checked: ["option1", "option2"]

Shared Parameters

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

Examples

composer.choiceInput("plan", {
  question: "Select your subscription plan",
  choices: ["Free", "Pro", "Enterprise"],
  required: true
});

Choice Types

Default behavior - Radio buttons allow users to select only one option from the list.When to use:
  • Mutually exclusive options (only one can be true)
  • Subscription tiers or plans
  • Yes/No questions
  • Single preference selection
composer.choiceInput("size", {
  question: "Select your size",
  choices: ["Small", "Medium", "Large", "X-Large"]
});
Set multiple: true to allow users to select multiple options.When to use:
  • Non-exclusive options (multiple can be true)
  • Feature selections
  • Interest categories
  • Permission settings
  • Multi-select preferences
composer.choiceInput("toppings", {
  question: "Select your pizza toppings",
  choices: ["Pepperoni", "Mushrooms", "Olives", "Peppers"],
  multiple: true,
  description: "Choose as many as you like"
});

Layout Options

Choices are stacked vertically, which is ideal for:
  • Longer choice labels
  • Many options (5+)
  • Small screen sizes
composer.choiceInput("country", {
  question: "Select your country",
  choices: ["United States", "Canada", "United Kingdom", "Australia"]
});

Use Cases

Product Selection

Let users choose product variants, sizes, or options.

Survey Questions

Create survey forms with single or multiple choice questions.

Preferences

Collect user preferences and settings.

Agreement Forms

Get consent or agreement through yes/no choices.

Best Practices

Order choices logically:
  • Alphabetical for long lists
  • Most common to least common
  • Smallest to largest (sizes, numbers)
  • Chronological (dates, time periods)
Keep labels clear and concise:
  • Use parallel structure
  • Be specific and unambiguous
  • Avoid jargon unless necessary
  • Keep length consistent when possible
Use choiceInput when:
  • 7 or fewer options
  • Users need to see all options at once
  • Visual comparison is important
Use selectBox when:
  • 8 or more options
  • Saving space is important
  • Options are well-known (like countries)
When using multiple: true:
  • Indicate in the description that multiple selections are allowed
  • Consider pre-selecting common or recommended options
  • Don’t require selection if users may want none
description: "Choose all that apply"

Return Value

Returns a string containing the Forms.md markup for the choice input field. Single selection returns: The value of the selected choice (string) Multiple selection returns: Array of selected choice values (string[])

selectBox

Dropdown selection for longer lists

pictureChoice

Visual choice selection with images

ratingInput

Star or heart rating scales