---
title: Configure Slider Scale Labels
product: Form Library
description: Learn how to configure and customize scale labels on SurveyJS Single-Value Slider and Range Slider questions. This demo covers auto-generated labels, custom label definitions, and label formatting options. Create clear, user-friendly sliders with meaningful visual reference points or hide labels entirely if needed.
framework: Vue 3
source: https://surveyjs.io/form-library/examples/customize-slider-scale-labels/vue3js
index: https://surveyjs.io/form-library/examples/overview.md
---

# Configure Slider Scale Labels (Vue 3)

Labels divide the slider scale into visual reference points and give users a clear idea of the available range. Users can click a label to select the corresponding value. Both the SurveyJS Single-Value Slider and Range Slider inputs support auto-generated and custom scale labels. This demo shows how to configure either type, format the labels, or hide them entirely.

## Auto-Generated Scale Labels

To generate labels automatically, specify their number using the [`labelCount`](/form-library/documentation/api-reference/questionslidermodel#labelCount) property. By default, six labels are displayed. In this demo, the number is increased to 11. Each label is positioned at the value it represents.

## Custom Scale Labels

If the auto-generated labels don't meet your needs, you can define custom ones using the [`customLabels`](/form-library/documentation/api-reference/questionslidermodel#customLabels) array. Each item in this array should be a number&mdash;the scale value where the label should appear&mdash;or an object with the following fields:

- `value`: `number`         
The scale value where the label should appear.

- `text`: `string`          
The label text to display.

When defined, custom labels override auto-generated ones. This example demonstrates how to use `customLabels` to display descriptive text instead of numeric values.

## Label Formatting

To apply a specific format to scale labels, use the [`labelFormat`](/form-library/documentation/api-reference/questionslidermodel#labelFormat) property. Include the `{0}` placeholder in your format string to insert the label value&mdash;for example, to prefix labels with a dollar sign. You can use the same formatting approach for thumb tooltips using the [`tooltipFormat`](/form-library/documentation/api-reference/questionslidermodel#tooltipFormat) property.

> If you are using custom labels, `labelFormat` affects only those that do not define the `text` property.

If you want to hide all scale labels, set the [`showLabels`](/form-library/documentation/api-reference/questionslidermodel#showLabels) property to `false`.

## Files

### `public/index.html`

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

### `src/App.vue`

```html
<template>
    <SurveyComponent :model="survey" />
</template>
<script setup lang="ts">
    import { Model } from "survey-core";
    import { SurveyComponent } from "survey-vue3-ui";
    import "survey-core/survey-core.min.css";
    import "./index.css";
    import { json } from "./json";

    const survey = new Model(json);
    survey.onComplete.add((sender, options) => {
        console.log(JSON.stringify(sender.data, null, 3));
    });
</script>
```

### `src/index.css`

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

### `src/json.ts`

```ts
export const json = {
  "elements": [
    {
      "type": "slider",
      "name": "increase-label-count",
      "title": "Auto-generated scale labels",
      "description": "Label count = 11",
      "labelCount": 11
    },
    {
      "type": "slider",
      "name": "custom-labels",
      "title": "Custom scale labels",
      "customLabels": [
        {
          "value": 0,
          "text": "Low"
        },
        {
          "value": 50,
          "text": "Average"
        },
        {
          "value": 100,
          "text": "High"
        }
      ]
    },
    {
      "type": "slider",
      "sliderType": "range",
      "name": "format-labels-and-tooltips",
      "title": "Format tooltips and scale labels",
      "labelFormat": "{0}$",
      "tooltipFormat": "{0}$"
    },
    {
      "type": "slider",
      "sliderType": "range",
      "name": "without-labels",
      "title": "Range slider without scale labels",
      "showLabels": false
    }
  ]
};
```

### `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
}
```

### `src/theme.ts`

```ts
export const themeJson = {};
```

### `.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",
    "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/form-library/examples/customize-slider-scale-labels/angular.md)
- [React](https://surveyjs.io/form-library/examples/customize-slider-scale-labels/reactjs.md)
- [jQuery](https://surveyjs.io/form-library/examples/customize-slider-scale-labels/jquery.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/customize-slider-scale-labels/vanillajs.md)
