Skip to main content

Choice Value Model

The choice value model describes a choice. A user can select one of the choices. If you want to allow a user to not select any choice, then you need to add empty choice (''). The null value is not supported here.

Example

Check the Editors Example.

Configuration

import { createChoiceValueModel } from 'sequential-workflow-editor-model';

builder
.property('foo')
.value(
createChoiceValueModel({
choices: [
'red',
'blue',
'green'
],
defaultValue: 'blue'
})
);

Required properties:

  • choices - the list of choices.

Optional properties:

  • defaultValue - the default value. If this property is not specified, then the first choice is the default value.

Value Reading

To read the value you just need to read the property value:

const value: string = step.properties['foo']; // 'red' or 'blue' or 'green'