If you want to extend the select's Menu and add custom elements to it, then you have to provide the itemListRenderer
prop.
Here's what the docs says:
By default, Select renders the displayed items in a Menu. This
behavior can be overridden by providing the itemListRenderer prop,
giving you full control over the layout of the items. For example, you
can group items under a common heading, or render large data sets
using react-virtualized.
itemListRenderer example:
If provided, the itemListRenderer prop will be called to render the contents of the dropdown menu. It has access to the items, the current query, and a renderItem callback for rendering a single item. A ref handler (itemsParentRef) is given as well; it should be attached to the parent element of the rendered menu items so that the currently selected item can be scrolled into view automatically.
Therefore in the Menu
component's body you can place your custom headings and buttons:
import { ItemListRenderer } from "@blueprintjs/select";
const renderMenu: ItemListRenderer<Film> = ({ items, itemsParentRef, query, renderItem }) => {
const renderedItems = items.map(renderItem).filter(item => item != null);
return (
<Menu ulRef={itemsParentRef}>
<h2>Your heading can be styled here</h2>
<MenuItem
disabled={true}
text={`Found ${renderedItems.length} items matching "${query}"`}
/>
{renderedItems}
<div>
<button>Button name</button>
</div>
</Menu>
);
};
<FilmSelect
itemListRenderer={renderMenu}
itemPredicate={filterFilm}
itemRenderer={renderFilm}
items={...}
onItemSelect={...}
/>