ItemsMenu

How to get ItemsMenu

import { ItemsMenu } from 'fds/components';

Type: Component

A VirtualList which renders MenuItem components. This component is generally used as a menu within drop components. For example, SingleAutocomplete implements an ItemsMenu.

Props

# Name Type Description
1. [allowMultipleSelectedValues] Boolean

Whether or not multiple selected values are allowed.


  Default value
false
2. items Array<Item>
  Item

Type: Object

An item with properties used to render ListItem components from.

Properties

Name Type Description
icon String

The name of the icon displayed in the component.

This should be one of the FontAwesome (v5 Pro) icon names with an optional style prefix ('far ' is the default prefix). For more info, see the Font Awesome concept page.

isDisabled Boolean

Whether or not the component should be rendered in a disabled state.

label String

The human readable label displayed in the component.

tooltipContent String | ReactElement

The content of the tooltip that is displayed when hovering over the whole component.

  • string: the textual content of the tooltip

  • ReactElement: a React Element (instance of a React Component, usually created with JSX)

value *

The current value of the component. This value will be visualized in the component, often using a human readable label, sometimes using another visual indication (e.g. Checkbox).

Depending on the component, the data type in JavaScript might be restricted further: eg: a TimeSelect might expect a Date, a TextInput a string etc. These restrictions are implemented with React PropTypes console warnings.

3. [maxHeight] Number | String

The maximum height of the component, sets the CSS "max-height" property.

  Default value
null
4. onChange Function

A callback that is called whenever a component's value changes.

This callback is called just before the "validate" prop is called.

Use this callback to update local state which in turn should update the value prop of the component whose callback just fired.


  Arguments
# Name Type Description
1. value Value | Array<ItemWithLabelAndValueValue>

A single value or an array of values, depending on the component that is changing.


  Value

Type: *

The current value of the component. This value will be visualized in the component, often using a human readable label, sometimes using another visual indication (e.g. Checkbox).

Depending on the component, the data type in JavaScript might be restricted further: eg: a TimeSelect might expect a Date, a TextInput a string etc. These restrictions are implemented with React PropTypes console warnings.

  ItemWithLabelAndValueValue

Type: *

The value of an ItemWithLabelAndValue.

This value is used to compare items, eg. when determining the selected item(s).

Depending on the component, the data type in JavaScript might be restricted further: eg: a TimeSelect might expect a Date, a TextInput a string etc. These restrictions are implemented with React PropTypes console warnings.

5. values Array<Value>
  Default value
[]

  Value

Type: *

The current value of the component. This value will be visualized in the component, often using a human readable label, sometimes using another visual indication (e.g. Checkbox).

Depending on the component, the data type in JavaScript might be restricted further: eg: a TimeSelect might expect a Date, a TextInput a string etc. These restrictions are implemented with React PropTypes console warnings.

6. [virtualBufferFactor] Number

The factor which a virtualized list (like VirtualList) uses to determine how much of the rendered items should be buffered off-screen. This helps increase the performance of the list by decreasing the amount of render hits that occur.

This factor is multiplied by the height of the list. For example, a list being 500 pixels high with a virtualBufferFactor of 2 would result in 1000 pixels worth of items being rendered off-screen on both the top and bottom of the list.

  Default value
4
Was this page helpful?