score:3
Accepted answer
one way to do it is to create your own select component like customselect
that you import instead of react-select
where you set for one the custom style
or theme
like:
import react, { component } from 'react'
import select from 'react-select'
class customselect extends component {
render() {
const styles = {
...
// what ever you need
}
return <select styles={styles} {...this.props} />
}
}
export default customselect
i can't really tell if it's the best way or not but i've tried both of it and in a big project with many select it's the easiest way to maintain / modify it. plus it's really convenient if at some point you need to have custom components.
Source: stackoverflow.com
Related Query
- How do I set a default value for a select menu in my React form component?
- How to set global style for a react-select.js
- How to set style for map item in react js
- How to add global style option for a react UI library?
- How to set different values for different material select using states in functional component of react
- How to set global property for react using esbuild
- How to set default value for select field in React js
- How to test style for a React component attribute with Enzyme
- How to use an array as option for react select component
- How to set NODE_ENV from package.json for react
- How to set headers for a React app created using 'create-react-app'
- How to set React default props for object type
- How to add global loading/spin effect in axios interceptor for a React project
- How to set placeholder for dropdown in react js?
- How to set -webkit-overflow-scrolling inline style on react component
- How to set up analytics on React Native for iOS
- How do you set the Typescript type for useRef hook in React Native?
- How to make React input onChange set state only after onChange stops firing for set time?
- how do I set logging levels on Android, for react native?
- how to set font size for different IOS devices in react native
- How to set display name for a React class (ES6)?
- React Cookie + ReactJS: How to set expiration time for a cookie?
- How can I programmatically set the user details for Launch Darkly in my react app
- how to set default value in select using react js
- React semantic UI: How to set focus for input field of dropdown element
- How to have different style for items at certain locations in a list in React Native?
- How can I style the arrow of react select component?
- JSDoc: How to set @param for React element as a function param?
- How to set object type props value in an enzyme for a react component?
- How to set a global font family in react js?
More Query from same tag
- Material UI Grid drag and drop
- Needing help trying to solve: 'state' is not defined no-undef
- "React.createContext is not a function" in CodeSandbox when using `@emotion/core` and latest version of React
- How to change JSON data through textboxes and buttons in a ReactJS?
- How to import images into CSS Modules?
- Why does React call the render method of an unchanged component?
- How to use the svg fill url in react
- ReactFire - get 'Objects are not valid as a React child' when binding Firebase to React state
- Geeting value differance in MUI date picker
- When testing, code that causes React state updates should be wrapped into act
- React - this.state not updated onSubmit
- Redux Reducer won't set boolean object property
- Make images in a text clickable in React
- ReactJS: How do replace a string with new elements in a 'react-way'
- Property 'options' is optional in type '{ question: number , label: string; ...etc}' but required in type '{ question: any; label: string, etc.}
- Uncaught (in promise) ReferenceError: data is not defined in react component
- This.props is not a function
- How to use object that I am getting as string in props
- Force line break after first word in a div in React component
- Material UI zoom animate out then remove
- setValue from material UI select
- Will react automatically remove eventlisteners when a component unmounts?
- Why is my dispatch/console.log not firing when I call the action?
- Recharts line chart cut off top line
- react-split-pane cannot resize
- How do i filter the array in object of array?
- React custom hook with event listener not works while updating the state
- Child component function not called from parent in reactjs
- useState not update variable
- Is it a good practice to use React useEffect as listener to trigger action?