【问题标题】:How to change Dropdown Indicator position on react-select如何更改反应选择上的下拉指示器位置
【发布时间】:2020-10-08 02:39:00
【问题描述】:

是否可以在 React Select 组件上将下拉指示器更改为左侧的“浮动”(而不是默认的右侧)?

我正在检查其 API 上的下拉指示器 props,但目前没有任何线索..

【问题讨论】:

    标签: reactjs drop-down-menu react-select


    【解决方案1】:

    由于容器正在使用flex,因此您可以通过反转行顺序将下拉指示器向左移动

    const customStyles = {
      control: (base) => ({
        ...base,
        flexDirection: "row-reverse"
      })
    };
    
    <Select
      styles={customStyles}
      options={options}
    />
    

    现场演示

    【讨论】:

    • 谢谢,太聪明了!
    猜你喜欢
    • 2016-03-08
    • 2022-12-15
    • 1970-01-01
    • 1970-01-01
    • 2021-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多