Can i change arrow (dropdown indicator) to my svg,png icon
in example : https://codesandbox.io/s/jz33xx66q9?module=/example.js
i want to use image (.svg , .png) instance emoji
how to use that
@bonusbb Please don't post questions to Github. Keep questions over at StackOverflow as per request by the maintainers in the issue template.
In the example you sent you just have to replace the EmojiIcon with the link of the image you want.
const DropdownIndicator = (
props: ElementConfig<typeof components.DropdownIndicator>
) => {
return (
<components.DropdownIndicator {...props}>
<img src="https://via.placeholder.com/30x30"/>
</components.DropdownIndicator>
);
};
And then on your component:
<Select
closeMenuOnSelect={false}
components={{ DropdownIndicator }}
defaultValue={[colourOptions[4], colourOptions[5]]}
isMulti
options={colourOptions}
/>
how do you change for
If you're using the example above from @michaelmota make sure to add this line in your file:
import Select, { components } from "react-select";
In the example you sent you just have to replace the EmojiIcon with the link of the image you want.
const DropdownIndicator = ( props: ElementConfig<typeof components.DropdownIndicator> ) => { return ( <components.DropdownIndicator {...props}> <img src="https://via.placeholder.com/30x30"/> </components.DropdownIndicator> ); };And then on your component:
<Select closeMenuOnSelect={false} components={{ DropdownIndicator }} defaultValue={[colourOptions[4], colourOptions[5]]} isMulti options={colourOptions} />
I want to remove the Arrow and the vertical line just before that. How can I achieve it ?
I want to remove the Arrow and the vertical line just before that. How can I achieve it ?
@kushhemant you need to use customStyles. Inside it, set dropdownIndicator and indicatorSeparator to display: "none" like so:
indicatorSeparator: () => ({ display: "none" }),
I want to remove the Arrow and the vertical line just before that. How can I achieve it ?
<Select
components={{
DropdownIndicator: () => null,
IndicatorSeparator: () => null,
}}
/>
In the example you sent you just have to replace the EmojiIcon with the link of the image you want.
const DropdownIndicator = ( props: ElementConfig<typeof components.DropdownIndicator> ) => { return ( <components.DropdownIndicator {...props}> <img src="https://via.placeholder.com/30x30"/> </components.DropdownIndicator> ); };And then on your component:
<Select closeMenuOnSelect={false} components={{ DropdownIndicator }} defaultValue={[colourOptions[4], colourOptions[5]]} isMulti options={colourOptions} />
how to this typescript error?
Cannot find name 'ElementConfig'.
In the example you sent you just have to replace the EmojiIcon with the link of the image you want.
const DropdownIndicator = ( props: ElementConfig<typeof components.DropdownIndicator> ) => { return ( <components.DropdownIndicator {...props}> <img src="https://via.placeholder.com/30x30"/> </components.DropdownIndicator> ); };And then on your component:
<Select closeMenuOnSelect={false} components={{ DropdownIndicator }} defaultValue={[colourOptions[4], colourOptions[5]]} isMulti options={colourOptions} />how to this typescript error?
Cannot find name 'ElementConfig'.
Change it with DropdownIndicatorProps instead,
import Select, { DropdownIndicatorProps } from "react-select";
The error Cannot find name 'ElementConfig' is still there.
Here's how I fixed it:
import Select, { type DropdownIndicatorProps, components } from "react-select";
const DropdownIndicator: React.FC<DropdownIndicatorProps> = (props) => {
return (
<components.DropdownIndicator {...props}>
<img src="https://via.placeholder.com/30x30"/>
</components.DropdownIndicator>
);
};
<Select
components={{ DropdownIndicator }}
options={options}
/>