---
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: React
source: https://surveyjs.io/form-library/examples/ui-adaptation-modes-for-rating-scale/reactjs
index: https://surveyjs.io/form-library/examples/overview.md
---

# UI Adaptation Modes for Rating Scale (React)

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/SurveyComponent.jsx`

```js
import React from "react";
import { Model } from "survey-core";
import { Survey } from "survey-react-ui";
import "survey-core/survey-core.min.css";
import "./index.css";
import { json } from "./json";

function SurveyComponent() {
    const survey = new Model(json);
    survey.onComplete.add((sender, options) => {
        console.log(JSON.stringify(sender.data, null, 3));
    });
    return (<Survey model={survey} />);
}

export default SurveyComponent;
```

### `src/index.css`

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

### `src/index.js`

```js
import React from "react";
import { createRoot } from "react-dom/client";
import SurveyComponent from "./SurveyComponent";

const root = createRoot(document.getElementById("surveyElement"));
root.render(<SurveyComponent />);
```

### `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": {
    "react": "latest",
    "react-dom": "latest",
    "survey-core": "latest",
    "survey-react-ui": "latest"
  },
  "devDependencies": {
    "react-scripts": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/ui-adaptation-modes-for-rating-scale/angular.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)
- [Vanilla JS](https://surveyjs.io/form-library/examples/ui-adaptation-modes-for-rating-scale/vanillajs.md)
