如何为 react-select 设置自定义宽度

问题描述 投票:0回答:1

你好,有没有一种方法来设置一个自定义的宽度在我的反应选择按钮?我想它,如果我可以使用bootstrap做到这一点,所以它可以是响应的,但如果没有它的罚款。

这是我的代码。

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>



        )


    }


}

css reactjs styles react-select
1个回答
0
投票

我只是使用bootstrap的大小吧!

这是我添加的内容。


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

© www.soinside.com 2019 - 2024. All rights reserved.