.. default-domain:: js .. highlight:: js .. module:: UI :no-index: Dropdown ======== .. class:: Dropdown A control for choosing one of a list of options, which are shown when it is clicked. Added to a :class:`UI.Canvas` or a :class:`UI.Panel`. | Base class: :class:`UI.InputControl` .. container:: inherited-members .. rubric:: Inherited Members * From :class:`UI.InputControl`: :meth:`getChanged `, :meth:`setChanged ` * From :class:`UI.Control`: :meth:`getInteractable `, :meth:`setInteractable `, :meth:`getColor `, :meth:`setColor `, :meth:`getTooltip `, :meth:`setTooltip ` * From :class:`UI.Object`: :meth:`getRectTransform `, :meth:`getLayoutElement `, :meth:`getVisible `, :meth:`setVisible `, :meth:`remove ` .. method:: getOptions() setOptions(value) The options that the dropdown offers. :Property: Can be read or written :rtype: ``Array`` of ``string`` .. note:: Setting the options resets the selection to the first of them, or to nothing when the list is empty. .. method:: getSelectedIndex() setSelectedIndex(value) The position in :meth:`UI.Dropdown.getOptions` of the option that is chosen. :Property: Can be read or written :rtype: ``number`` .. note:: Zero while the dropdown has no options, as there is nothing to choose.