Referenceoption

<option>

<option> is a General Operator component that defines a selection element within a <select> block. If only <math> type components are to be selected, the <option> component can be excluded and selection items can simply be listed with a space between list items. However, if multiple types or complex selections are required, the <option> component is necessary.

When varying component types are used as options, such as a <text>, <function>, or <number>, these tags are nested within the <option> tag.

Attributes and Properties

Attributes for <option>
AttributeTypeValues
selectForVariants = "…"textListFromString
selectWeight = "…"number
Props for <option name="o">
PropertyType
$o.disabledboolean
$o.fixedboolean
$o.fixLocationboolean
$o.hiddenboolean
$o.selectForVariantstextListFromString
$o.selectWeightnumber

Example: <option> type math

Three options for a variable name are nested within a <select>. The type of each <option> must be specified.

Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.


Example: <option> type text

Three options for a variable name are nested within a <select>. The type of each <option> must be specified.

Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.


Example: <option> type vector

Three options for a variable name are nested within a <select>. The type of each <option> must be specified.

Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.


Example: Multiple <option> types within a <select>

The <option> component is used to define multiple component types as choices within a <select> block.

Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.


Example: Retrieving <option> selections with multiple elements

It is possible to group several components for selection within a single <option> component. In order to reference a specific component within a selected <option>, use array notation. The first index of the array notation refers to the selected <option> component, and the second index refers to the specific component within the <option> component.

Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.


Attribute Example: selectWeight

The <option> component is used with the selectWeight attribute. This attribute takes any numerical value and defaults to 1. In the case below, the red option is twice as likely to be selected during recursive selections (note that the <select> component has attribute specification withReplacement="true") as the green or yellow options.

Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.