首页 > 解决方案 > 如何更改反应选择上的下拉指示器位置

问题描述

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

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

标签: reactjsdrop-down-menureact-select

解决方案


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

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

现场演示

编辑 64255002/how-to-change-dropdown-indicator-position-on-react-select


推荐阅读