Create Custom Adorners
Adorners are interactive design-surface controls placed within a question area. Adorners allow users to quickly execute the most common actions: duplicate a question, mark a question as required, or delete it. This demo shows how to customize built-in adorners and create custom adorners.
Create a Button Adorner
A button adorner executes a simple action on click. To create a button adorner, follow the steps below:
Handle the
onElementGetActionsevent.
This event is raised when Survey Creator renders adorners on the design surface.Create an
Actioninstance.
Pass anIActionconfiguration object to theActionconstructor. This object describes an action item rendered as a button adorner.Add the
Actioninstance to theoptions.itemsarray.
This demo shows how to create a custom Read-Only button adorner. Refer to the code listing for more information.
Create a Drop-Down Adorner
A drop-down adorner opens a drop-down menu on click. The following instructions describe how to create a drop-down adorner:
Handle the
onElementGetActionsevent.Create an
Actioninstance.
Drop-down adorners have a dedicatedcreateDropdownActionModel()helper function that generatesActioninstances based onIActionandIActionDropdownPopupOptionsconfiguration objects. Import this function fromsurvey-coreand passIActionandIActionDropdownPopupOptionsobjects to it.Add the
Actioninstance to theoptions.itemsarray.
In this demo, a custom Sort Order drop-down adorner lets users specify the order of items in choice-based questions. For details about implementation, view code listings for Angular, React, Vue, jQuery, or Vanilla JavaScript.