---
title: UI Adaptation Modes for Rating Scale
product: Form Library
description: Discover the advantage of an adaptive display mode, which automatically adjusts the Rating scale type to the screen size and device of the respondent, for a seamless user experience. View a free demo for JavaScript.
framework: Vanilla JS
source: https://surveyjs.io/form-library/examples/ui-adaptation-modes-for-rating-scale/vanillajs
index: https://surveyjs.io/form-library/examples/overview.md
---

# UI Adaptation Modes for Rating Scale (Vanilla JS)

A Rating Scale question can change its display mode type to match the width of the used device. Two display options are available&mdash;a linear Likert scale and a drop-down menu. When the width is insufficient to fit the entire set of rate buttons, the Rating Scale question displays rate values in a drop-down menu. If you want to disable this behavior, set the [`displayMode`](/form-library/documentation/api-reference/rating-scale-question-model#displayMode) property to `"buttons"` or `"dropdown"`. Note that the `"buttons"` mode automatically generates line breaks when all rate buttons cannot fit into the available width.

## Files

### `public/index.html`

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

### `src/index.css`

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

### `src/index.js`

```js
import { Model } from "survey-core";
import "survey-js-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));
});

survey.render(document.getElementById("surveyElement"));
```

### `src/json.js`

```js
export const json = {
  "width": "750px",
  "widthMode": "static",
  "questions": [
    {
      "type": "rating",
      "name": "satisfaction-auto",
      "title": "How satisfied are you with our product?",
      "description": "Display mode = Auto",
      "minRateDescription": "Not satisfied",
      "maxRateDescription": "Completely satisfied"
    },
    {
      "type": "rating",
      "name": "satisfaction-buttons",
      "title": "How satisfied are you with our product?",
      "description": "Display mode = Button UI",
      "minRateDescription": "Not satisfied",
      "maxRateDescription": "Completely satisfied",
      "displayMode": "buttons"
    },
    {
      "type": "rating",
      "name": "satisfaction-dropdown",
      "title": "How satisfied are you with our product?",
      "description": "Display mode = Dropdown",
      "minRateDescription": "Not satisfied",
      "maxRateDescription": "Completely satisfied",
      "displayMode": "dropdown"
    }
  ]
};
```

### `src/theme.js`

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

### `package.json`

```json
{
  "dependencies": {
    "survey-core": "latest",
    "survey-js-ui": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/ui-adaptation-modes-for-rating-scale/angular.md)
- [React](https://surveyjs.io/form-library/examples/ui-adaptation-modes-for-rating-scale/reactjs.md)
- [Vue 3](https://surveyjs.io/form-library/examples/ui-adaptation-modes-for-rating-scale/vue3js.md)
- [jQuery](https://surveyjs.io/form-library/examples/ui-adaptation-modes-for-rating-scale/jquery.md)
