-1

For a multi-select dropdown, is it possible to display one selected item (+ number of remaining items)

enter image description here

instead of listing all items in the textbox:

enter image description here

user989988
  • 3,006
  • 7
  • 44
  • 91

1 Answers1

0

It is supported to customize via Dropdown.onRenderTitle:

Optional custom renderer for selected option displayed in input

For example:

<Dropdown
    onRenderTitle={this.handleRenderTitle}
    ...    
/>

where

private handleRenderTitle(items: IDropdownOption[]) {
    if(items.length === 1) {
      return <>{`${items[0].text}`}</>;
    }
    return <>{`${items[0].text} (+ ${items.length - 1})`}</>;
}

Result

enter image description here

Vadim Gremyachev
  • 57,952
  • 20
  • 129
  • 193