ink-select-input icon indicating copy to clipboard operation
ink-select-input copied to clipboard

Allow to not select anything

Open SimenB opened this issue 6 years ago • 1 comments

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

SimenB avatar Mar 08 '19 15:03 SimenB

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

SimenB avatar Mar 09 '19 07:03 SimenB