简体   繁体   中英

How to set custom width for react-select

Hello is there a way to set a custom width in my react select button? I would like it if I can use bootstrap to do that so it can be responsive but if not its okay.

Here is my code:

import Select, { components } from 'react-select';
export default class AccomodationType extends Component {

    render() {
        const options = [
            { value: 'chocolate', label: 'Chocolate' },
            { value: 'strawberry', label: 'Strawberry' },
            { value: 'vanilla', label: 'Vanilla' }
          ]
        return(
            <div>
                <Select
                options= {options}
                isClearable
                isSearchable
                name="color"
            />
                </div>



        )


    }


}

I just used bootstrap sizing for it!

Here is what I added:


                <Select
                className="w-25 p-3"
                options= {options}
                isClearable
                isSearchable
                name="color"
            />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM