palantir/blueprint

[Select2] Better support for "sticky" items

Open

#6080 opened on Apr 19, 2023

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (20,263 stars) (2,167 forks)batch import
P2Package: selectType: feature requesthelp wanted

Description

Feature request

There's currently no way to easily add "stick" items to be rendered within a Select2. There's currently support for createNewItem* features, where you can place this "create new item" either first or last in the last. However, there's no way to make this item last while also having it always render in the Select2 (if last, it may have to be scrolled to if there are enough items before it), so the only way to guarantee this "create new item" will be shown is to render it first. In addition to createNewItemPosition, it would be nice to support some kind of isCreateNewItemSticky: boolean that would cause the item to be sticky at either the top or bottom of the list depending on createNewItemPosition.

Note: this UX is probably most likely hit with createNewItem* features, and probably easiest to implement if we focus on only this item, but I could imagine some other more generalized solutions that allow us to make arbitrary items in the list as "sticky" that could be useful (e.g. maybe scrolling a long list of options separated by header dividers, you may want the currently viewed section's header to be sticky at the top as you scroll)

Contributor guide