---
title: Title Customization
product: Form Library
description: Change the way a question title, its number, and the Required sign look and how they are positioned. Play with this free demo for JavaScript to see the modifications in action.
framework: React
source: https://surveyjs.io/form-library/examples/modify-question-title/reactjs
index: https://surveyjs.io/form-library/examples/overview.md
---

# Title Customization (React)

Question and page titles provide context and help organize survey content into logical sections. This example demonstrates built-in title customization options.

## Title Anatomy

Question and page titles consist of the following parts:

- Title text
- *(Optional)* Question or page number
- *(Optional)* A symbol or text that indicates a required question or page

### Title Text

To set title text for a question or page, specify the [`title`](https://surveyjs.io/form-library/documentation/api-reference/question#title) property. If you leave it unspecified, a question displays the [`name`](https://surveyjs.io/form-library/documentation/api-reference/question#name) property value as a title, while a page displays no title.

### Question Numbers

To display question numbers, enable `SurveyModel`'s [`showQuestionNumbers`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#showQuestionNumbers) property. Questions are numbered starting with 1. If you want to start numbering with a different number or use letters instead, specify the [`questionStartIndex`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionStartIndex) property. You can include desired prefixes and postfixes in the property value. In this demo, you can change the `questionStartIndex` property value at runtime using the Settings panel.

For more information on how to manage numbering within your survey, refer to the following demo: [Question Auto-Numbering](https://surveyjs.io/form-library/examples/how-to-number-pages-and-questions/).

### Required Mark

Questions that require an answer are marked with an asterisk `*`. You can use `SurveyModel`'s [`requiredMark`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#requiredMark) property to set another symbol or specify an explanatory text string. Open the Settings panel to change the required mark in this demo.

### Title Pattern

You can arrange the question title, number, and required mark in different sequences. To do this, specify one of the [`questionTitlePattern`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionTitlePattern) property values: `"numTitleRequire"`, `"numRequireTitle"`, `"numTitle"`. Use the Settings panel to see how these values affect question titles.

## Dynamic Placeholders

Panels and questions support placeholders that may be useful in titles:

- `{pageno}`\
The current page number.

- `{pagecount}`\
A total number of visible pages.

- `{correctanswers}`\
The number of correct answers in a [quiz survey](https://surveyjs.io/form-library/examples/make-quiz-javascript/).

- `{incorrectanswers}`\
The number of incorrect answers in a quiz survey.

- `{questioncount}`\
A total number of visible questions.

In this demo, page titles use the `{pageno}` and `{pagecount}` placeholders.

## 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 = {
  "questionTitlePattern": "numTitleRequire",
  "questionStartIndex": "№1", 
  "requiredMark": "(*)",
  "showQuestionNumbers": true,
  "pages": [{
    "title": "Page {pageno} of {pagecount}",
    "elements": [{
      "type": "matrix",
      "name": "qualities",
      "title": "Please indicate if you agree or disagree with the following statements",
      "isRequired": true,
      "columns": [{
        "value": 5,
        "text": "Strongly agree"
      }, {
        "value": 4,
        "text": "Agree"
      }, {
        "value": 3,
        "text": "Neutral"
      }, {
        "value": 2,
        "text": "Disagree"
      }, {
        "value": 1,
        "text": "Strongly disagree"
      }],
      "rows": [{
        "value": "affordable",
        "text": "Product is affordable"
      }, {
        "value": "does-what-it-claims",
        "text": "Product does what it claims"
      }, {
        "value": "easy-to-use",
        "text": "Product is easy to use"
      }]
    }, {
      "type": "rating",
      "name": "satisfaction-score",
      "title": "How satisfied are you with our product?",
      "minRateDescription": "Not satisfied",
      "maxRateDescription": "Completely satisfied",
      "isRequired": true
    }, {
      "type": "comment",
      "name": "suggestions",
      "title": "What would make you more satisfied with our product?"
    }]
  }, {
    "title": "Page {pageno} of {pagecount}",
    "elements": [{
      "type": "radiogroup",
      "name": "price-comparison",
      "title": "Compared to our competitors, do you feel our product is:",
      "choices": [
        "Less expensive",
        "Priced about the same",
        "More expensive",
        "Not sure"
      ],
      "isRequired": true
    }, {
      "type": "radiogroup",
      "name": "current-price",
      "title": "Do you feel our current price is merited by our product?",
      "choices": [
        "correct|Yes, the price is about right",
        "low|No, the price is too low for your product",
        "high|No, the price is too high for your product"
      ],
      "isRequired": true
    }, {
      "type": "multipletext",
      "name": "price-limits",
      "title": "What is the highest and lowest price you would pay for a product like ours?",
      "items": [{
        "name": "highest",
        "title": "Highest"
      }, {
        "name": "lowest",
        "title": "Lowest"
      }]
    }]
  }, {
    "title": "Page {pageno} of {pagecount}",
    "elements": [{
      "type": "text",
      "name": "email",
      "title": "Please leave your email address if you would like us to contact you."
    }]
  }]
};
```

### `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/modify-question-title/angular.md)
- [Vue 3](https://surveyjs.io/form-library/examples/modify-question-title/vue3js.md)
- [jQuery](https://surveyjs.io/form-library/examples/modify-question-title/jquery.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/modify-question-title/vanillajs.md)
