Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-select does not auto scroll to the selected option

How can i use react-select to scroll to the selected option?

<Select
              matchProp='label'
              classes={classes}
              inputId="react-select-single"
              TextFieldProps={{
                InputLabelProps: {
                  htmlFor: 'react-select-single',
                  shrink: true,
                },
                disableUnderline: true
              }}
              options={options}
              components={components}
              value={single}
              onChange={handleChangeSingle}
            />
like image 541
WalksAway Avatar asked Apr 09 '26 23:04

WalksAway


1 Answers

You can use the react-select property,

      menuShouldScrollIntoView={true}

Thank you.

like image 190
GameChanger Avatar answered Apr 11 '26 15:04

GameChanger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!