dropdown

class virtualitics_sdk.elements.dropdown.Dropdown(options, selected=None, include_nulls_visible=True, include_nulls_value=False, multiselect=False, title='', description='', show_title=True, show_description=True, required=True, label='', placeholder='')

Bases: InputElement

A Dropdown Input element.

Parameters:
  • options (List[Union[int, float, str]]) – The options in the dropdown menu.

  • selected (Optional[List[Union[int, float, str]]]) – The option the user selected, defaults to [].

  • include_nulls_visible (bool) – whether null values will be visible, defaults to True.

  • include_nulls_value (bool) – whether to include null values, defaults to False.

  • multiselect (bool) – whether the user can select multiple values, defaults to False.

  • title (str) – The title of the element, defaults to ‘’.

  • description (str) – The element’s description, defaults to ‘’.

  • show_title (bool) – whether to show the title on the page when rendered, defaults to True.

  • show_description (bool) – whether to show the description to the page when rendered, defaults to True.

  • required (bool) – whether a selection needs to be submitted for the step to continue, defaults to True

  • label (str) – The label of the element, defaults to ‘’.

  • placeholder (str) – The placeholder of the element, defaults to ‘’.

EXAMPLE

# Imports
from virtualitics_sdk.elements.dropdown import Dropdown
. . .
# Example usage
class ExStep(Step):
  def run(self, flow_metadata):
    . . .
    dropdown_options = ['a', 'b', 'c']
    single_selection_dropdown = Dropdown(options=dropdown_options, 
                                         multiselect=False, 
                                         title="Single Selection Dropdown", 
                                         selected=['a'])
    multiple_selection_dropdown = Dropdown(options=dropdown_options, 
                                           multiselect=True, 
                                           title="Multiple Selection Dropdown", 
                                           selected=['a', 'b'])

The above single and multi Dropdown examples will be displayed as:

../_images/dropdown_ex.png
get_value()

Get the value of an element. If the user has interacted with the value, the default will be updated.

Return type:

Union[str, List[str]]

update_from_input_parameters()