Components

SelectInput

<SelectInput value name color options onChange />

Renders the SelectInput component A custom select input. NOTE: This component does not use the select and option HTML elements.

Constructor

# <SelectInput value name color options onChange />

Sets up the component state
PropTypes:
Name Type Required Description Default
value string Yes The value of the select (the current selected option or a custom one-time placeholder value)
name string Yes The select input's name
color enum Yes The component's background color. See options.
options arrayOf Yes Options for select component
onChange func Yes Select change handler (handles option changes)
Author:

View Source components/FormInputs/SelectInput/SelectInput.js, line 36

Members

string

# _maxLengthString

The maximum-length string of all selection options. Used to size the component properly.

View Source components/FormInputs/SelectInput/SelectInput.js, line 44

# _selectorRef

A reference to the outermost div element for this component. Uses a React Ref.

View Source components/FormInputs/SelectInput/SelectInput.js, line 67

# state

SelectInput component state
Properties:
Name Type Description
value string The current value of the select (the current selected option).
showDropdown boolean Indicates if the options dropdown should be shown
componentWidth number The current width of the component
componentHeight number The current height of the component
didScreenSizeChange boolean Indicates if the screen size changed

View Source components/FormInputs/SelectInput/SelectInput.js, line 54

Methods

# componentDidMount()

Adds a window resize listener. Updates state with the component's width and height.

View Source components/FormInputs/SelectInput/SelectInput.js, line 73

# componentDidUpdate()

Updates the actual value of the select. Updates state with the component's width and height if needed.

View Source components/FormInputs/SelectInput/SelectInput.js, line 94

# componentWillUnmount()

Removes the window resize listener

View Source components/FormInputs/SelectInput/SelectInput.js, line 119

# getArrowClassList() → {string}

Gets the CSS classes for the selector arrow

View Source components/FormInputs/SelectInput/SelectInput.js, line 236

A string of class names
string

# getMaxLengthString() → {string}

Gets the maximum length string based on all given selection options, as well as the provided value from props

View Source components/FormInputs/SelectInput/SelectInput.js, line 143

The maximum length string
string

# getOptions()

Creates option elements based on provided options from props. This is a custom version of the option HTML element.

View Source components/FormInputs/SelectInput/SelectInput.js, line 195

An array of option elements (JSX)

# getOptionsClassList() → {string}

Gets the CSS classes for the options container element

View Source components/FormInputs/SelectInput/SelectInput.js, line 219

A string of class names
string

# optionButtonClickedHandler()

Calls the onChange handler with the selected option. Updates state to close the options dropdown.
Parameters:
Type Description
number The index of the option clicked

View Source components/FormInputs/SelectInput/SelectInput.js, line 180

# render()

Renders the SelectInput component

View Source components/FormInputs/SelectInput/SelectInput.js, line 249

# selectorButtonClickedHandler()

Opens or closes the options dropdown

View Source components/FormInputs/SelectInput/SelectInput.js, line 166

# windowSizeChangedHandler()

Updates state to trigger a component resize if needed

View Source components/FormInputs/SelectInput/SelectInput.js, line 127