Styling is not applied to the select list.
After installing through npm when I add this snippet
<Select
name="filter-category"
value="one"
options={options}
onChange={logChange}
/>
I get a list but the styling is totally off. Can you help what's going wrong here.

Are you importing the component like import Select from 'react-select'; and using a bundler like Webpack? Then you have to import the CSS explicitly: import 'react-select/dist/react-select.css';
Otherwise this maybe interesting: https://github.com/JedWatson/react-select/issues/602
There was css loader missing with the https://github.com/christianalfoni/webpack-express-boilerplate webpack configuration
{
test: /\.css$/,
loader: 'style!css?modules&localIdentName=[name]---[local]---[hash:base64:5]',
include: path.join(__dirname, 'app')
},
{
test: /\.css$/,
loader: 'style!css',
include: path.join(__dirname, 'node_modules')
}
Shouldn't it be loading by default. Is this an issue with the module it self or just the config?
Mhh maybe the following line has something to do with it: https://github.com/JedWatson/react-select/blob/master/package.json#L6
Because this css file is not existing, currently?!
BTW @thirdknife is it working for you with the given loaders?
@bzums yes it's working for me with the loaders. I am closing this issue now.
@thirdknife can you elaborate on why a loader is necessary? I'm having the same issue, loading the style manually works as a solution, but I'd prefer not to!
@mattparrilla it's because if you read https://github.com/JedWatson/react-select/blob/master/package.json line 6 it says
"style": "dist/default.css",
but infact the dist folder does not contain default.css
@bzums
I import the component like import Select from 'react-select'; and using a bundler like Webpack. And every time I have to add import 'react-select/dist/react-select.css';?
Is there another simple way?
I''m using NPM and the CSS is missing - any ideas?
@mrconnormurphy you currently need to make sure you import the css - either the built .css file from /dist or you can include the .less or .sass versions into your own less or sass files (or import them directly with webpack loaders)
I'm thinking for simplicity of use, we might implement inline styles as an option, but that won't be for 1.0
in your js component fil just import the scss import 'react-select/scss/default.scss'
then in the webpack.config module loaders make sure to remove exclude: /node_modules/ beacause you will load the scss from that folder
@JedWatson Thanks Jed - appreciate it
I directly linked the CSS via my index.html file
<link rel="stylesheet" type="text/css" href="node_modules/react-select/dist/react-select.css">
This seemed to fix the CSS issue.
I had to copy the css from node_modules/react-select/dist/react-select.css into my own stylesheet to fix the css issue, and from there I can override some styles to fit my design.
How to fix it https://github.com/JedWatson/react-select/issues/602#issuecomment-254835096
I am still not able to fix the issue after following the above solutions. I am not using webpack. Steps i) Importing react-select import Select from "react-select"; ii) Using it in the component Select name="filter-category" value="one" options={options} onChange={logChange}
iii) Placed react-select.css in the same directory as above component. And imported it in the component. import "./react-select.css"; iv) When i npm run the client i am seeing the drop down in same format as the top image in this issue thread.
@JedWatson node_modules/react-select/dist/react-select.css this file does not exist in my node_modules directory. How to fix it? My react-select package version is 5.7.4
@JedWatson node_modules/react-select/dist/react-select.css this file does not exist in my node_modules directory. How to fix it? My react-select package version is 5.7.4
https://github.com/JedWatson/react-select/issues/5710#issuecomment-1913643129