For a multi-select dropdown, is it possible to display one selected item (+ number of remaining items)
instead of listing all items in the textbox:
For a multi-select dropdown, is it possible to display one selected item (+ number of remaining items)
instead of listing all items in the textbox:
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