Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-select in flex container

How can I make react-select to respect flex layout? Nothing of the below worked.

 const Container = styled('div')`
   width: 100%;
   height: 100%;
   display: flex;
   flex-flow: row wrap;
   justify-content: space-around;
   align-items: baseline;
 `;

const selectStyles = {
  input: base => ({
    minWidth: 200,
    flex: 1,

<Container>
<Select
  style={{ flex: 1 }}
  styles={selectStyles}
like image 579
Yuki Avatar asked Dec 23 '22 01:12

Yuki


1 Answers

To make your react-select component flex you need to apply flex:1 props on the container like this:

const styles = {
  container: base => ({
    ...base,
    flex: 1
  })
};

<Select styles={styles} />
like image 70
Laura Avatar answered Dec 25 '22 15:12

Laura