react-select icon indicating copy to clipboard operation
react-select copied to clipboard

Support for CSS namespacing

Open cosminnicula opened this issue 11 years ago • 1 comments

Are there any plans to allow namespacing the Sass classes?

For example, define a prefix variable inside Sass and then use it in all the Sass class definitions. So, basically instead of this:

.Select-control {
    ...
}

...you'll have this:

.#{$css-prefix}Select-control {
    ...
}

This has further implications inside the .js code, as the classNames are hardcoded (https://github.com/JedWatson/react-select/blob/master/src/Select.js#L459):

var className = classNames('Select-input', this.props.inputProps.className);

This could be easily mitigated by propagating through the context the CSS prefix.

cosminnicula avatar Nov 06 '15 15:11 cosminnicula

I get where this is coming from, but I'm really not keen to introduce this level of complexity into the codebase at this stage, and am looking at moving to a css-in-js solution because maintaining two independent css codebases is making the maintenance of react-select more difficult than it should be.

Hopefully if the Select- namespace for the control clashes with other components in anyone's apps, there are other ways to work around it.

JedWatson avatar Sep 12 '17 11:09 JedWatson