ink-select-input
ink-select-input copied to clipboard
Allow to not select anything
I want to use this component to render a list, and only make the user select if they actually press up or down. Sort of like a radiogroup without a value in the browser.
Currently I can set focus={false}, but that just means it doesn't respond to keypresses - it still renders like the top item is selected/highlighted
Ref https://github.com/vadimdemedes/ink/issues/138
Ended up with this solution which works fine:
{isScrolling ? (
<SelectInput items={items} limit={10} />
) : (
<Box marginLeft={2} flexDirection="column">
{items.slice(0, 10).map(i => (
<Box key={i.value}>
<Text>{i.label}</Text>
</Box>
))}
</Box>
)}
isScrolling being set if you press up or down