Add Custom Properties to the Property Grid
Survey elements include a number of built-in properties that cover most use cases. However, you can add custom properties to the survey elements if you want to extend their functionality. Custom properties can be serialized and included in the survey JSON schema. Both built-in and custom properties are set in the Property Grid of Survey Creator.
To add a custom property, call the addProperty(questionType, propertySettings)
method on the Survey.Serializer
object. This method accepts the following arguments:
questionType
A string value that specifies the question type to which the property should be added. You can use a specific type (see the getType description) or one of the base types. In the latter case, the new property is added to all question types derived from the base type. Refer to the API of a specific question type for information on its inheritance chain.propertySettings
Settings that configure the property's appearance and behavior. For information about these settings, refer to the following help section: Survey Element Property Settings.
This demo shows how to add custom properties to the survey, page, and all questions.