---
title: Manage Toolbox Subitems
product: Survey Creator
description: Easily add and remove nested toolbox items that help you create more specific configurations of a broader survey element type and group them. View a free demo example for JavaScript to learn more.
framework: Vue 3
source: https://surveyjs.io/survey-creator/examples/manage-toolbox-subitems/vue3js
index: https://surveyjs.io/survey-creator/examples/overview.md
---

# Manage Toolbox Subitems (Vue 3)

Toolbox items can have nested items, or "subitems". They appear when users hover over a toolbox item. Subitems help you create more specific configurations of a broader survey element type and group them. For example, the Single-Line Input toolbox item includes a number of subitems that create Single-Line Input questions with different "Input type" property values. **Hover over** the Single-Line Input toolbox item to view these subitems. This demo shows how to add a custom toolbox subitem and explains how to manage built-in subitems. For demonstration purposes, available toolbox items are limited to those that have subitems.

> Subitems are unavailable in a [compact toolbox](/survey-creator/documentation/toolbox-customization#full-and-compact-modes).

To create a custom subitem, pass its [configuration object](/survey-creator/documentation/api-reference/iquestiontoolboxitem) to the [`addSubitem(subitem, index)`](/survey-creator/documentation/api-reference/iquestiontoolboxitem#addSubitem) method. Call this method on a toolbox item instance to which you want to add the subitem. For instance, the following code adds a "Limited to 280 characters" subitem to the Long Text toolbox item:

```js
const longTextItem = creator.toolbox.getItemByName("comment");
longTextItem.addSubitem({
    name: "limitedLongText",
    title: "Limited to 280 characters",
    json: {
        type: "comment",
        maxLength: 280
    }
});
```

If you want to remove a specific subitem, call the [`removeSubitem(subitem)`](/survey-creator/documentation/api-reference/iquestiontoolboxitem#removeSubitem) method on a toolbox item instance. The following list contains the predefined subitems available by default:

- [Rating Scale](/form-library/examples/rating-scale/): `"labels"`, `"stars"`, `"smileys"`
- [Single Line-Input](/form-library/examples/text-entry-question/): `"color"`, `"date"`, `"datetime-local"`, `"email"`, `"month"`, `"number"`, `"password"`, `"range"`, `"tel"`, `"text"`, `"time"`, `"url"`, `"week"`

```js
// Remove the Labels subitem from the Rating Scale toolbox item
const ratingScaleItem = creator.toolbox.getItemByName("rating");
ratingScaleItem.removeSubitem("labels");
```

You can also remove all subitems from a toolbox item by calling the [`clearSubitems()`](/survey-creator/documentation/api-reference/iquestiontoolboxitem#clearSubitems) method:

```js
// Remove all subitems from the Single-Line Input toolbox item
const singleLineInputItem = creator.toolbox.getItemByName("text");
singleLineInputItem.clearSubitems();
```

> Toolbox subitems act like shortcuts for creating certain question configurations. Removing a subitem doesn't remove the associated properties from the Property Grid. If you need to prevent users from editing them, [hide those properties explicitly](/survey-creator/documentation/property-grid-customization#hide-properties-from-the-property-grid).

You can completely deactivate the subitems feature by disabling the Toolbox's [`showSubitems`](/survey-creator/documentation/api-reference/questiontoolbox#showSubitems) property:

```js
creator.toolbox.showSubitems = false;
```

## Files

### `public/index.html`

```html
<div id="app" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0;"></div>
```

### `src/App.vue`

```html
<template>
    <SurveyCreatorComponent :model="creator" />
</template>
<script setup lang="ts">
    import { SurveyCreatorModel } from "survey-creator-core";
    import { SurveyCreatorComponent } from "survey-creator-vue";
    import "survey-core/survey.i18n";
    import "survey-creator-core/survey-creator-core.i18n";
    import "survey-core/survey-core.css";
    import "survey-creator-core/survey-creator-core.css";
    import "./index.css";
    import SurveyTheme from "survey-core/themes";
    import { registerCreatorTheme } from "survey-creator-core";

    registerCreatorTheme(SurveyTheme); // Add predefined Survey Creator UI themes

    const creator = new SurveyCreatorModel({ questionTypes: [ "text", "rating", "comment", "paneldynamic" ] });
    // Do not categorize toolbox items since there are only four of them
    creator.toolbox.removeCategories();
    
    // Add a custom subitem to the Long Text toolbox item
    const longTextItem = creator.toolbox.getItemByName("comment");
    longTextItem.addSubitem({
        name: "limitedLongText",
        title: "Limited to 280 characters",
        json: {
            type: "comment",
            maxLength: 280
        }
    });
    
    // Add custom subitems to the Dynamic Panel toolbox item
    const dynamicPanelItem = creator.toolbox.getItemByName("paneldynamic");
    dynamicPanelItem.addSubitem({
        name: "tabbedDynamicPanel",
        title: "Tabbed UI",
        json: {
            type: "paneldynamic",
            displayMode: "tab"
        }
    });
    dynamicPanelItem.addSubitem({
        name: "carouselDynamicPanel",
        title: "Carousel UI",
        json: {
            type: "paneldynamic",
            displayMode: "carousel"
        }
    });
    
    // Add custom subitems to the Rating Scale toolbox item
    const ratingItem = creator.toolbox.getItemByName("rating");
    ratingItem.addSubitem({
        name: "csat",
        title: "Customer Satisfaction Score",
        json: { 
            "type": "rating",  
            "rateType": "smileys", 
            "rateCount": 5, 
            "title": "How satisfied are you with our product?",
            "minRateDescription": "Very unsatisfied",
            "maxRateDescription": "Very satisfied"
        }
    });
    
    ratingItem.addSubitem({
        name: "nps",
        title: "Net Promoter Score",
        json:  { 
            "type": "rating", 
            "title": "How likely are you to recommend our product to a friend or colleague?", 
            "rateMin": 0, 
            "rateMax": 10 
        }
    });
    
    // Disable the compact toolbox because subitems are available only in full toolbox view 
    creator.toolbox.forceCompact = false;
</script>
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/main.ts`

```ts
import { createApp } from "vue";
import App from "./App.vue";

const app = createApp(App);
app.mount("#app");
```

### `src/shims-vue.d.ts`

```ts
/* eslint-disable */
declare module "*.vue" {
    import type { DefineComponent } from "vue"
    const component: DefineComponent<{}, {}, any>
    export default component
}
```

### `.eslintrc.js`

```js
module.exports = {
    root: true,
    env: {
        node: true
    },
    extends: [
        "plugin:vue/vue3-essential",
        "eslint:recommended",
        "@vue/typescript/recommended",
        "@vue/prettier",
        "@vue/prettier/@typescript-eslint"
    ],
    parserOptions: {
        ecmaVersion: 2020
    },
    rules: {
        "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
        "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
    },
    overrides: [
        {
            files: [
                "**/__tests__/*.{j,t}s?(x)",
                "**/tests/unit/**/*.spec.{j,t}s?(x)"
            ],
            env: {
                jest: true
            }
        }
    ]
};
```

### `babel.config.js`

```js
module.exports = {
  presets: ["@vue/cli-plugin-babel/preset"]
};
```

### `package.json`

```json
{
  "name": "surveyjs-library-vue3",
  "version": "0.1.0",
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "tslib": "2.6.1",
    "vue": "^3.4.1",
    "survey-core": "latest",
    "survey-vue3-ui": "latest",
    "survey-creator-core": "latest",
    "survey-creator-vue": "latest",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^2.33.0",
    "@typescript-eslint/parser": "^2.33.0",
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-pwa": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-typescript": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/eslint-config-prettier": "^6.0.0",
    "@vue/eslint-config-typescript": "^5.0.2",
    "@vue/test-utils": "^2.0.0-0",
    "eslint": "^6.7.2",
    "eslint-plugin-prettier": "^3.1.3",
    "eslint-plugin-vue": "^7.0.0-0",
    "node-sass": "^4.12.0",
    "prettier": "^1.19.1",
    "sass-loader": "^8.0.2",
    "typescript": "~3.9.3"
  }
}
```

### `tsconfig.json`

```json
{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env",
      "jest"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/survey-creator/examples/manage-toolbox-subitems/angular.md)
- [React](https://surveyjs.io/survey-creator/examples/manage-toolbox-subitems/reactjs.md)
- [jQuery](https://surveyjs.io/survey-creator/examples/manage-toolbox-subitems/jquery.md)
- [Vanilla JS](https://surveyjs.io/survey-creator/examples/manage-toolbox-subitems/vanillajs.md)
