Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing DownChevron in components doesn't work #3739

Open
SpadarShut opened this issue Aug 28, 2019 · 11 comments · May be fixed by #3959
Open

Providing DownChevron in components doesn't work #3739

SpadarShut opened this issue Aug 28, 2019 · 11 comments · May be fixed by #3959
Assignees
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer issue/has-pr Issue has a PR attached to it that may solve the issue issue/reviewed Issue has recently been reviewed (mid-2020)

Comments

@SpadarShut
Copy link

The docs say that

The following components are customisable and switchable:

But passing DownChevron in components prop doesn't do anything, here's an example https://codesandbox.io/s/react-codesandboxer-example-jvo50.
Is it docs wrong or something's broken?

@buszmen201
Copy link

works for me with DropdownIndicator prop

const Icon = ({ innerRef, innerProps }) => (
  <span role="img" aria-label="Dropdown emoji" ref={innerRef} {...innerProps}>
    👇
  </span>
);
const components = {
  DropdownIndicator: Icon,
};
export default class SingleSelect extends Component {
  render() {
    return (
      <Select
        className="basic-single"
        classNamePrefix="select"
        name="color"
        options={colourOptions}
        components={components}
      />
    );
  }
}

image

@tpict
Copy link

tpict commented Nov 2, 2019

I'd classify this as a bug–see


The reference to DownChevron is hardcoded instead of being pulled out of props

@jamesmoss
Copy link

The exact same issue also affects CrossIcon.

@ayushnawani
Copy link

Unable to replace CrossIcon.

@flexdinesh flexdinesh self-assigned this May 19, 2020
@flexdinesh flexdinesh added the issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer label May 19, 2020
@bladey bladey added issue/reviewed Issue has recently been reviewed (mid-2020) issue/has-pr Issue has a PR attached to it that may solve the issue labels Jun 18, 2020
@bladey
Copy link
Contributor

bladey commented Jul 8, 2020

Hi all,

What you want to do here is pass in ClearIndicator or DropdownIndicator to replace the cross icon or down chevron as per @buszmen201's suggestion.

The docs are correct and show examples, with Custom ClearIndicator Example and Custom Dropdown Indicator Example on the components page .

See working example here (based off @buszmen201's code): https://codesandbox.io/s/react-codesandboxer-example-yxnpz?file=/example.js:129-146

Let me know if I'm missing something!

@bladey bladey closed this as completed Jul 8, 2020
@jkbmat
Copy link

jkbmat commented Jul 15, 2020

Hi @bladey,
this is more like a workaround, as for example CrossIcon is also used in MultiValueRemove, so you need to override two components just to get a different looking ❌.

Also the docs are still wrong, because they list ClearIndicator and DropdownIndicator as switchable, when they aren't.

I can live with that if you decide to disregard the PR, just correcting the record.

@bladey
Copy link
Contributor

bladey commented Jul 16, 2020

Thanks for clarifying @jkbmat, much appreciataed, let me take another look!

@bladey bladey reopened this Jul 16, 2020
@andresmatasuarez
Copy link

andresmatasuarez commented Jul 28, 2020

can confirm the exact same happens with CrossIcon. @bladey Any updates on this?

@bladey bladey added issue/reviewed Issue has recently been reviewed (mid-2020) and removed issue/reviewed Issue has recently been reviewed (mid-2020) labels Aug 24, 2020
@yard2010
Copy link

Hey,
This issue seems to be stalled, is there anything I can do to help?

@Methuselah96
Copy link
Collaborator

@yard2010 There's an existing PR that fixes the issue, but there are some changes that need to be made and it looks like the author might not get to them. If you want, you can create another PR with the requested changes and we'll look into merging it.

@tzs007
Copy link

tzs007 commented Jul 7, 2021

try with built in "components" object like this

import React from "react";
import { components as C } from "react-select";
import Icon from "components/ui/PureIcon";

const ReactSelectDropdownIndicator = (props) => {
  return (
    <div>
      <C.DropdownIndicator {...props}>
        <Icon
          icon={{
            name: "ExpandMore",
            size: "xxs",
            color: "danger",
          }}
        />
      </C.DropdownIndicator>
    </div>
  );
};

export default ReactSelectDropdownIndicator;

C.DropdownIndicator update the original element with this component's children

Sorry for Icon component, it's mine, it's absolutely custom, it's just an example, so feel free to use any other Icon package like react-icons-kit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-confirmed Issues about a bug that has been confirmed by a maintainer issue/has-pr Issue has a PR attached to it that may solve the issue issue/reviewed Issue has recently been reviewed (mid-2020)
Projects
None yet
Development

Successfully merging a pull request may close this issue.