Css nu属性工作正常。 ... import Select from 'react-select' ... const styles = { fontSize: 14, color: 'blue', } <Select options={
nu属性工作正常。Css nu属性工作正常。 ... import Select from 'react-select' ... const styles = { fontSize: 14, color: 'blue', } <Select options={,css,reactjs,react-select,Css,Reactjs,React Select,nu属性工作正常。 ... import Select from 'react-select' ... const styles = { fontSize: 14, color: 'blue', } <Select options={[1,2,3,4]} placeholder={'Select something'} clearable={false} style={styles.select} /> const colourStyles
...
import Select from 'react-select'
...
const styles = {
fontSize: 14,
color: 'blue',
}
<Select
options={[1,2,3,4]}
placeholder={'Select something'}
clearable={false}
style={styles.select}
/>
const colourStyles = {
control: styles => ({ ...styles, backgroundColor: 'white' }),
option: (styles, { data, isDisabled, isFocused, isSelected }) => {
const color = chroma(data.color);
return {
...styles,
backgroundColor: isDisabled ? 'red' : blue,
color: '#FFF',
cursor: isDisabled ? 'not-allowed' : 'default',
...
};
},
...
};
export default () => (
<Select
defaultValue={items[0]}
label="Single select"
options={items}
styles={colourStyles}
/>
);
const options = [
{label: "one", value: 1, className: 'custom-class'},
{label: "two", value: 2, className: 'awesome-class'}
// more options...
];
...
<Select options={options} />
const options = [
{label: "one", value: 1, style: { color: 'red' }},
{label: "two", value: 2, style: { color: 'blue' }}
// more options...
];
...
<Select options={options} />
const CustomStyle = {
option: (base, state) => ({
...base,
backgroundColor: state.isSelected ? {Color1} : {Color2},
})
}
<Select styles={customStyle} >
import React from "react";
import Select from "react-select";
class SelectComponent extends React.Component {
componentDidMount() {}
render() {
const { data } = this.props;
const options = [
{ value: "21", label: "21%" },
{ value: "9", label: "9%" },
{ value: "0", label: "0%" }
];
const theme = theme => ({
...theme,
colors: {
...theme.colors,
primary25: "#f3f3f3",
primary: "pink"
// All possible overrides
// primary: '#2684FF',
// primary75: '#4C9AFF',
// primary50: '#B2D4FF',
// primary25: '#DEEBFF',
// danger: '#DE350B',
// dangerLight: '#FFBDAD',
// neutral0: 'hsl(0, 0%, 100%)',
// neutral5: 'hsl(0, 0%, 95%)',
// neutral10: 'hsl(0, 0%, 90%)',
// neutral20: 'hsl(0, 0%, 80%)',
// neutral30: 'hsl(0, 0%, 70%)',
// neutral40: 'hsl(0, 0%, 60%)',
// neutral50: 'hsl(0, 0%, 50%)',
// neutral60: 'hsl(0, 0%, 40%)',
// neutral70: 'hsl(0, 0%, 30%)',
// neutral80: 'hsl(0, 0%, 20%)',
// neutral90: 'hsl(0, 0%, 10%)',
}
// Other options you can use
// borderRadius: 4
// baseUnit: 4,
// controlHeight: 38
// menuGutter: baseUnit * 2
});
return (
<Select
className="select"
defaultValue={options[0]}
options={options}
theme={theme}
/>
);
}
}
export default SelectComponent;
<Select
classNamePrefix='filter'
options={this.getOptions()}
onChange={this.handleFilterChange}
isMulti
menuIsOpen
/>
.filter {
&__menu {
margin: 0.125rem auto;
}
&__option {
background-color: white;
&--is-focused {
background-color: lightblue;
}
}
&__group {
padding: 0;
}
&__menu-portal {
border: 1px solid darkblue;
}
}