Yes/No Question

Edit in →
Survey Creator

A Yes/No, or Boolean, question asks respondents to select between two options: yes or no, true or false, etc. Boolean questions can be used to implement conditional survey logic or as standalone questions. This example demonstrates how to create and configure a Boolean question in SurveyJS Form Library. Switch between Angular, React, Knockout, jQuery, and Vue to view an example for your JavaScript framework. Read more...

Settings Themes

Color palette
Question appearance
Sorry, we can't retrieve the data from server. Please comeback later.

A Yes/No, or Boolean, question asks respondents to select between two options: yes or no, true or false, etc. Boolean questions can be used to implement conditional survey logic or as standalone questions. This example demonstrates how to create and configure a Boolean question in SurveyJS Form Library. Switch between Angular, React, Knockout, jQuery, and Vue to view an example for your JavaScript framework.

Create a Yes/No Question

To create a Boolean question, define an object with the type property set to "boolean" and add it to the elements array. Within this object, specify the question's title and a unique name that identifies the question.

Change Positive and Negative Text Labels

A Boolean question displays "Yes" for the positive answer and "No" for the negative answer. Use the labelTrue and labelFalse properties to change the displayed text labels. In this demo, you can use Settings to change the labels at runtime.

Save Custom Values for true and false

Survey results store true or false as an answer to a Boolean question. If you want to save custom values instead, assign them to the valueTrue and valueFalse properties. You will still be able to access the selected Boolean value via the booleanValue property. In this demo, Boolean questions save "Yes" or "No" in survey results.

Change Display Mode

Boolean questions support the following UI modes:

  • Slider
  • Radio button group
  • Checkbox

The slider mode automatically applies when labels are short; the radio button group mode—when they are long. To use a specific display mode, set the renderAs property to "radio" or "checkbox". This example demonstrates all three display modes.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.