Skip to content

ComboBoxDisplay

Overview

ComboBoxDisplay is the lovechild of a ComboBox and a NumberDisplay. It allows the user to choose one of N dynamic numeric values. ComboBox was designed to display static choices, so this component ensures that none of its items grow wider/taller than their initial size.

@author Chris Malley (PixelZoom, Inc.)

Class ComboBoxDisplay

import { ComboBoxDisplay } from 'scenerystack/scenery-phet';

Constructor

new ComboBoxDisplay( choiceProperty : Property<T>, items : ComboBoxDisplayItem<T>[], listParent : Node, providedOptions? : ComboBoxDisplayOptions )

Instance Methods

dispose()

Type ComboBoxDisplayItem

Describes an item in the ComboBoxDisplay

import type { ComboBoxDisplayItem } from 'scenerystack/scenery-phet';
  • choice: T
    a value of choiceProperty that corresponds to the item
  • numberProperty: TReadOnlyProperty<number | null>
    the item's numeric value
  • range: Range
    the range of the item's numeric value
  • units: string | TReadOnlyProperty<string>
    the units used to label the item's numeric value
  • numberDisplayOptions?: SubsetOfNumberDisplayOptions
    options passed to this item's NumberDisplay, these override ComboBoxDisplayOptions.numberDisplayOptions
  • tandemName?: string
    tandem name for the item

Type ComboBoxDisplayOptions

import type { ComboBoxDisplayOptions } from 'scenerystack/scenery-phet';
  • numberDisplayOptions?: SubsetOfNumberDisplayOptions
    propagated to all NumberDisplay subcomponents, will be overridden by ComboBoxDisplayItem.numberDisplayOptions
  • & ComboBoxOptions

Source Code

See the source for ComboBoxDisplay.ts in the scenery-phet repository.