react-select: 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.

About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (1 by maintainers)
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';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 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
@bzums
I import the component like
import Select from 'react-select';and using a bundler like Webpack. And every time I have to addimport 'react-select/dist/react-select.css';?Is there another simple way?
@mrconnormurphy you currently need to make sure you import the css - either the built
.cssfile from/distor you can include the.lessor.sassversions 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
@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.cssThere was css loader missing with the https://github.com/christianalfoni/webpack-express-boilerplate webpack configuration
Shouldn’t it be loading by default. Is this an issue with the module it self or just the config?