Customize the Evaluation Options Editor UI using variants

When you create an editor with createEditor(), you can choose from two UI variants. The variant controls how the editor is presented to authors.

Default variant

The default variant renders the editor directly in the page, with a tab for each group of options: General, Content, Moderation, and Explainability. Authors can switch between the Edit view and the View Source view, which shows the options as JSON.

Use the default variant on dedicated configuration pages, where the editor is the main focus and needs the most space.

The default variant has no confirm button. The change event fires each time the author edits an option.

To use the default variant, omit the variant option, or set it to "default":

const editor = await evaluationOptionsEditorApp.createEditor.createEditor({
    variant: "default"
});

Code example: Creating the Evaluation Options Editor with the default variant.

The default variant..png
The default variant.

Modal variant

The modal variant renders an Evaluation options button in the container you attach the editor to. Selecting the button opens the editor in a dialog, with Cancel and Confirm Options buttons in the footer.

Use the modal variant when the editor shares the page with other content. It keeps your page uncluttered and lets authors open the editor when they need it. Author API uses this variant for the Evaluation options button in the scoring settings of a Question.

In the modal variant:

  • The Confirm Options button is available after the author makes a valid change. When the author selects it, the options are saved, the button label changes to Confirmed Options, and the change event fires. The dialog stays open until the author closes it.
  • If the author selects Cancel or closes the dialog, the editor discards any changes that have not been confirmed, and the change event does not fire.

To use the modal variant, set the variant option to "modal":

const editor = await evaluationOptionsEditorApp.createEditor.createEditor({
    variant: "modal"
});

Code example: Creating the Evaluation Options Editor with the modal variant.

The button displays the Feedback Aide icon by default. To hide the icon, set the enable_modal_variant_button_icon option to false:

const editor = await app.createEditor({
    variant: "modal",
    enable_modal_variant_button_icon: false
});

Code example: Creating the modal variant without the Feedback Aide icon on the button.

The modal variant, with the dialog open..png
The modal variant, with the dialog open.
Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.