如何为 react-select 设置自定义宽度
How to set custom width for react-select
您好,有没有办法在我的 React select 按钮中设置自定义宽度?
如果我可以使用 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>
)
}
}
我刚用了 bootstrap 尺码!
这是我添加的:
<Select
className="w-25 p-3"
options= {options}
isClearable
isSearchable
name="color"
/>
您好,有没有办法在我的 React select 按钮中设置自定义宽度? 如果我可以使用 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>
)
}
}
我刚用了 bootstrap 尺码!
这是我添加的:
<Select
className="w-25 p-3"
options= {options}
isClearable
isSearchable
name="color"
/>