Repository navigation
Support disabled/unselectable items in SelectionPrompt<T> #2179
thomas-mathers
started this conversation in
Ideas
Replies: 1 comment
|
I have nothing against something like this, as long as the API isn't breaking since we're currently moving towards a 1.0 release, and a lot of people are using prompts. Every PR needs an issue, so if you could create one with the proposed changes it would be great! 👍 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Long-time fan of Spectre.Console. It's been a great fit for the console apps I build.
I'm working on a project where a
SelectionPrompt<T>needs to show choices that are temporarily unavailable (e.g. an action that can't currently be used), visible in the list for context, but not navigable to or selectable. Right now there's no way to do this:ISelectionItem<T>has no per-item enabled/disabled state, andDisabledStyleis only ever applied to group headers inMode.Leaf.Proposed API, mirroring the existing
IMultiSelectionItem<T>.IsSelected/Select()pattern:I've prototyped this locally. It extends
ListPromptItem<T>,SelectionPrompt<T>'s render/input handling, andListPromptState<T>'s navigation/search filtering to treat disabled leaves the same way group headers already are (styled, skipped during arrow-key nav and search, blocked on submit). Small, additive, backward-compatible diff, and I've added tests covering the navigation/search/default-value edge cases. Happy to open a PR if this is something you'd be open to.All reactions