Documentation Docs
Documentation Docs

QuestionToolbox

An object that enables you to modify Survey Creator's Toolbox. To access this object, use the toolbox property on a Survey Creator instance:

const creatorOptions = { ... };
const creator = new SurveyCreator.SurveyCreator(creatorOptions);
creator.toolbox.settingName = "value";

// In modular applications:
import { SurveyCreatorModel } from "survey-creator-core";

const creatorOptions = { ... };
const creator = new SurveyCreatorModel(creatorOptions);
creator.toolbox.settingName = "value";

Toolbox Customization

activeCategory property

Gets or sets the currently expanded category. Applies only if allowExpandMultipleCategories and keepAllCategoriesExpanded are false and showCategoryTitles is true.

Default value: ""

Type:
string readonly
Implemented in:
QuestionToolbox
See also:
expandCategory * , collapseCategory
addItem method

Adds a new item to the Toolbox.

Type:
(item: IQuestionToolboxItem, index?: number) => void
Parameters:
item, type: IQuestionToolboxItem ,

A toolbox item configuration.

index, type: number ,

(Optional) A zero-based index at which to insert the item. If you do not specify this parameter, the item is added to the end.

Implemented in:
QuestionToolbox
See also:
removeItem * , replaceItem * , items

Specifies whether more than one category can be in the expanded state at a time. Applies only if showCategoryTitles is true.

If this property is false, the currently expanded category collapses when a user expands another category.

Default value: false

Type:
boolean writable
Implemented in:
QuestionToolbox
See also:
keepAllCategoriesExpanded
categories property

Contains toolbox categories and allows you to modify them.

View Demo

Type:
any readonly
Implemented in:
QuestionToolbox
See also:
defineCategories * , showCategoryTitles

Changes the categories of multiple toolbox items.

Type:
(items: any) => void
Parameters:
items, type: any ,

An array of objects with the following structure: { name: "toolboxItemName", category: "newCategoryName" }.

Implemented in:
QuestionToolbox
See also:
defineCategories

Changes the category of a toolbox item.

Type:
(itemName: string, categoryName: string) => void
Parameters:
itemName, type: string ,

A toolbox item's name.

categoryName, type: string ,

A new category name. Out-of-the-box category names include "general", "choice", "text", "containers", "matrix", and "misc".

Implemented in:
QuestionToolbox
See also:
defineCategories
clearItems method

Removes all items from the Toolbox.

Type:
() => void
Implemented in:
QuestionToolbox
See also:
removeItem * , addItem * , items

Collapses all categories. Applies only if showCategoryTitles and allowExpandMultipleCategories are true.

Type:
() => void
Implemented in:
QuestionToolbox
See also:
expandAllCategories

Collapses a category with a specified name. Applies only if showCategoryTitles and allowExpandMultipleCategories are true.

Type:
(categoryName: string) => void
Parameters:
categoryName, type: string ,

A category name. Out-of-the-box category names include "general", "choice", "text", "containers", "matrix", and "misc".

Implemented in:
QuestionToolbox
See also:
expandCategory

Adds default items to the Toolbox. If the Toolbox contains any items before you call this method, they will be removed.

Type:
(supportedQuestions: any, useDefaultCategories: boolean) => void
Parameters:
supportedQuestions, type: any ,

Specifies which question and panel types to include in the Toolbox.

useDefaultCategories, type: boolean ,

Pass true if you want to create default categories.

Implemented in:
QuestionToolbox

Defines toolbox categories from scratch.

This method accepts an array of objects as the categories parameter. Each object defines a single category and lists items included into it. Unlisted items can be collected in the Misc category if you pass true as the displayMisc parameter. Optionally, you can override display titles for individual items.

The following code defines two toolbox categories: Dropdowns and Text Input. Items that do not fall into either category are collected in Misc. The "comment" item has a custom display title.

creator.toolbox.defineCategories([{
  category: "Dropdowns",
  items: [
    "dropdown",
    "tagbox"
  ]
}, {
  category: "Text Input",
  items: [
    "text",
    // Override the display title
    { name: "comment", title: "Multi-Line Input" }
  ]
}], true);

View Demo

Type:
(categories: any, displayMisc?: boolean) => void
Parameters:
categories, type: any ,

An array of new categories.

displayMisc, type: boolean ,

Pass true if you want to collect unlisted toolbox items in the Misc category. Default value: false.

Implemented in:
QuestionToolbox

Expands all categories. Applies only if showCategoryTitles and allowExpandMultipleCategories are true.

Type:
() => void
Implemented in:
QuestionToolbox
See also:
collapseAllCategories

Expands a category with a specified name. Applies only if showCategoryTitles is true.

If allowExpandMultipleCategories is false, all other categories become collapsed.

Type:
(categoryName: string) => void
Parameters:
categoryName, type: string ,

A category name. Out-of-the-box category names include "general", "choice", "text", "containers", "matrix", and "misc".

Implemented in:
QuestionToolbox
See also:
collapseCategory
forceCompact property

Specifies whether the Toolbox should be in compact or full mode.

Possible values:

  • true - Toolbox is always in compact mode.
  • false - Toolbox is always in full mode.
  • undefined (default) - Toolbox switches between the full and compact modes automatically based on available width.

View Toolbox Customization Demo

Type:
boolean readonly
Implemented in:
QuestionToolbox
See also:
isCompact
getItemByName method

Returns a toolbox item with a specified name.

Type:
(name: string) => QuestionToolboxItem
Parameters:
name, type: string ,

A toolbox item's name.

Return Value:

A toolbox item or null if a toolbox item with the specified name isn't found.

Implemented in:
QuestionToolbox
isCompact property

Indicates whether the Toolbox is currently in compact mode.

Type:
boolean readonly
Implemented in:
QuestionToolbox
items property

An array of toolbox items.

Type:
any readonly
Implemented in:
QuestionToolbox
See also:
getItemByName * , addItem * , removeItem

Specifies whether to expand all categories without the capability to collapse any of them. Applies only if showCategoryTitles is true.

Type:
boolean writable
Implemented in:
QuestionToolbox
See also:
allowExpandMultipleCategories
overflowBehavior property

Specifies how the Toolbox behaves when it contains more items than can fit on the screen.

Possible values:

  • "scroll" (default) - Enables scrolling to help users reach the items that do not fit on the screen.
  • "hideInMenu" - Hides the overflow items in a three-dot menu.
Type:
overflowBehaviorType readonly
Implemented in:
QuestionToolbox

Removes all categories from the Toolbox.

Type:
() => void
Implemented in:
QuestionToolbox
removeItem method

Removes a toolbox item with a specified name.

Type:
(name: string) => boolean
Parameters:
name, type: string ,

A toolbox item's name.

Return Value:

true if the item is successfully deleted or false otherwise.

Implemented in:
QuestionToolbox
See also:
clearItems * , addItem * , items
replaceItem method

Adds a new toolbox item and deletes an existing item with the same name (if there is any).

Type:
(item: IQuestionToolboxItem) => boolean
Parameters:
item, type: IQuestionToolboxItem ,

A toolbox item configuration.

Implemented in:
QuestionToolbox
See also:
addItem
searchEnabled property

Specifies whether to display a search field that allows users to find question and panel types within the Toolbox.

Default value: true

Type:
boolean readonly
Implemented in:
QuestionToolbox

Specifies whether to display category titles in the Toolbox.

Default value: false

If this property is disabled, the Toolbox hides the titles but continues to display horizontal lines that divide categories. To remove these lines as well, call the removeCategories() method.

Type:
boolean writable
Implemented in:
QuestionToolbox
See also:
allowExpandMultipleCategories * , keepAllCategoriesExpanded
showSubitems property

Specifies whether toolbox items support subitems.

Default value: true

Manage Toolbox Subitems

Type:
boolean readonly
Implemented in:
QuestionToolbox

Copyright © 2024 Devsoft Baltic OÜ. All rights reserved.

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.