pick icon indicating copy to clipboard operation
pick copied to clipboard

Support for disabled list entries?

Open blackbit42 opened this issue 5 years ago • 3 comments

I have a use-case for pick where i want to display say items 1..8, but two of them, 3 and 6 are not viable options, but 'known' to the underlying system. The user shouldn't be able to select the not viable items, as that would make them expect that action is taken, whereas that is not the case, because it's not possible to do so. I want to be able to visualize that fact that these items are 'known' and not simply leave them out as the user wouldn't be able to differentiate between unknown and disabled items.

I can imagine two different ways to visually represent that. I think option 1 is preferable, considering lists can be longer than a screen is high, making option 2 non-straight-forward to grasp):

  1. Keep the list and its ordering as provided to the pick function, visually differentiating the disabled from the enabled options (different color, prefix, something like that). Disabled options are skipped when navigating the list

  2. Presenting enabled and disabled items in two separate lists.

A necessary implication is that items passed to pick() must be tuples, indicating for each item whether it is enabled or disabled.

blackbit42 avatar Aug 08 '19 14:08 blackbit42

I'm not sure if it is a widely needed feature so I'll wait to see if there're more +1s. But PRs are always welcome!

wong2 avatar Jan 29 '20 05:01 wong2

I have a similar use case.

mkamran37 avatar Sep 17 '20 19:09 mkamran37

I think it makes sense to extend the option strings to a option class, with various customisation possibilities and styles. An option could be non-selectable, or purely text between option groups and etc.

chuan137 avatar Feb 03 '22 08:02 chuan137