-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V2] Option to disable CSS-in-JSS entirely #2706
Comments
@JedWatson this is a valid line of inquiry, and may be in lined with roadmap for an unthemed select export. Would be nice to get your thoughts on this. |
This is a very valid point and a reason for me not currently upgrading to the latest version, I use this library in several projects and all implementations have custom styles, some of which already use CSS-in-JS libraries. I'm interested to find out the rational behind this decision? |
I'd also like to have a way to break the dependency on the
It would be great to have an example/docs of how to style v2 using something like the react-select.css from v1. If the ability to disable css-in-jss is added then it would be great to also show how to do that in the same example/docs section. |
It's hard to add CSS by class name. Because |
This is a blocker for us using react-select unfortunately. The use of emotion means:
If there was a (tree-shakeable) way to disable emotion when using react-select, it would avoid both issues. |
This is as well blocking me from using react-select. I have all styles compiled to one style.css file so I would love to have an option to get rid of inline styles and see some normal classes not Using existing classes makes it really hard to even try to write my own styling that makes any sense... Please give us option to disable CSS-in-JSS. |
The docs indicate Does a working example of using css-modules exist? |
is this open to consideration? For projects that are not yet into the css-in-js craze it makes sense to just disable it and use the good 'ol stylesheets. |
I'm working on updating a legacy app from v1 to v2 and came across this issue. My component now looks really weird. Any chance backwards-compatibility could be added? |
This issue and the bundle size issue mentioned in #2972 have led our team to hold off indefinitely from upgrading to V2. Unfortunately I don't have any experience with emotion, so don't feel comfortable submitting a PR to address the issue (nor do I know if it would be accepted, given the lack of comment from contributors to this issue). We love this package and are very grateful for all the hard work the contributors have put into it. |
This makes working with react-select incredibly frustrating as it forces an opinionated way of styling the components on you. It would be incredibly useful to have an option to disable css-in-js completely and instead just pass standard class names to the components. This then gives us the freedom to choose how we style the components. |
I wholeheartedly agree .. we need to be able to disable CSS-in-JS. The fact that this route has been chosen, and is impossible to override has stopped us from using react-select. |
Emotion seems to be racking up performance hits in my tests. Would be nice if there was a way to simply turn it off. Perhaps there could be a webpack plugin that excludes emotion and we maintain a community CSS file? |
In case it helps anyone, I literally just forked react-select at version 1.30 into a new package called I haven't gotten around to making a README etc, but it's published to npm and working great for me: https://www.npmjs.com/package/react-select-css |
Great issue and I experience the same. I don't want to use a component that adds unnecessary complexity / size to my application. By the way, that is the big strength of Cascading StyleSheet that you aren't coupled to the specific component 😄 Providing only a default theme in a SASS file and working with
This approach would be compatible with CSS and CSS-in-js solutions without adding any overhead. Example in CSS/SASS<style>
.react-select {
padding: 4px;
}
.react-select .sub-component {
}
</style>
<Select></Select> Example in styled-components with nestingconst Thing = styled.div`
.react-select {
padding: 4px;
}
.react-select .sub-component {
}
`
<Thing>
<Select></Select>
</Thing> Example in emotion with nestingconst select = css`
.react-select {
padding: 4px;
}
.react-select .sub-component {
}
`
<Select css={select}></Select> |
This library doesn't work too well with CSS modules OOTB as far as I can tell. In React if I import styles via
there is no effective way to utilize the |
@onionhammer we're able to get it to work with what feels like a hack:
and in css
|
Greetings, A solution has been posted here to disable the default styles: #2872 (comment) While the generated classNames will still be present in the DOM, the corresponding styles will not be added to the page. const styleProxy = new Proxy({}, {
get: (target, propKey) => () => {}
});
<Select styles={styleProxy} {...} /> Here is a working demo to illustrate it: codesandbox This should satisfy this condition such that this issue can be closed. If anyone has any other questions or concerns, feel free to reply and this can be re-opened if necessary. |
This approach in no good at all |
We're planning on create an "unstyled" version of react-select where you can bring your own styles (or turn them off completely). |
That would solve a ton of issues then 🚀 |
@Methuselah96 is there any ETA for this? Edit: const styleProxy = new Proxy(
{},
{
get: (target, propKey) => () => {}
}
);
const App = (props) => {
return <Select styles={styleProxy} options={basicOptions} />;
}; And then proceed to style the select box using Should work for now, in case anyone also needs react-select unstyled. |
No, there's no ETA at the moment. The top two priorities are fixing menu positioning and creating an unstyled version but it's hard to estimate how soon we can finish those up since the amount of time we can work is not always consistent. |
@Methuselah96 any progress on that "unstyled" version please ? |
How is it going with the unstyled version? It would be great to have a prop to disable "emotion css" completely. |
I guess this is still relavant? Especially if you need your own instance of emotion there's conflict emotion-js/emotion#2383 And this package is outdated. |
I have a NextJS app that is server side rendered, which uses the built in styled jsx. I'd really rather not have to add emotion-server to the application, just so there's no flash of unstyled select boxes. I would also much prefer to keep my style definitions to one system and one format.
I absolutely adore the functionality of react-select, but enforcing a specific CSS-in-JS solution for a component that will have to live within so many different kinds of environments seems like a misstep. IMO, the things it offers, like theming, should be done at an application- or framework-level, not a single component level.
Using className alone somewhat gets me there, but I now have two sets of CSS classes and two styling systems competing for primacy on the page, which is hard to debug, diagnose, and manage.
I realise that it's probably not going away, and assuming that is a non-starter, can we have the ability to just disable emotion, and do all the styling ourselves? That will be painful, but at least there will only be one authority.
The text was updated successfully, but these errors were encountered: