Skip to content
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

theme support #109

Closed
piecyk opened this issue Mar 25, 2015 · 10 comments
Closed

theme support #109

piecyk opened this issue Mar 25, 2015 · 10 comments
Assignees

Comments

@piecyk
Copy link
Contributor

piecyk commented Mar 25, 2015

For better override styles (when you need to have 3 components whit different look) created something like props.theme, ref to gist

https://gist.github.com/piecyk/14cfd932aabd1989ff10

and usage

var theme = {
  SelectControl: 'my-Select-control',
  SelectPlaceholder: 'my-Select-placeholder'
};

var selectProps = {
  asyncOptions: loadOptions,
  onChange: this.onChange,
  theme: theme,
  name: "react-select-test"
};
return (<Select {...selectProps} />);

i want to created a pull request with this, but maybe is there a better solution... any thoughts?

@dcousens
Copy link
Collaborator

dcousens commented May 7, 2015

@jossmac you might have a better handle on this could be done.

@piecyk
Copy link
Contributor Author

piecyk commented May 7, 2015

👍

@cedricdelpoux
Copy link

I'm interested by the theme support. Is a PR in progress about this ?

@jossmac
Copy link
Collaborator

jossmac commented Aug 25, 2015

@JedWatson might be time to convert to Radium, thoughts?

@piecyk
Copy link
Contributor Author

piecyk commented Jan 17, 2017

@jossmac any news about this ?

@jossmac
Copy link
Collaborator

jossmac commented Jan 17, 2017

@piecyk depending on the result of some research for a commercial project, it's likely that we'll re-implement using styled-components

@petejodo
Copy link

petejodo commented Mar 29, 2017

@jossmac if you re-implement using styled-components, will the reimplementation include a theme prop that would be able include some custom classes?

Specifically, I'd like to be able to do something like...

// my-select-one.scss

$select-input-height: 50px;
$select-input-border-radius: 0;
$select-item-font-size: 16px;
$select-padding-vertical: 17px;
$select-padding-horizontal: 18px;

@import "../node_modules/react-select/scss/default";


// my-select-two.scss

$select-input-height: 25px;
$select-input-border-radius: 2;
// ...

@import "../node_modules/react-select/scss/default";

And then, using css-modules, I can easily get 2 differently designed selects by passing the outputted object as the theme prop

@jossmac
Copy link
Collaborator

jossmac commented Mar 29, 2017

@petejodo I'd like to provide more granular control of the component styles. Though the best pattern I've discovered so far uses Glamor by itself.

Theme
Basically just a massive list of variables that you can override, things like inputPaddingHorizontal etc.

CSS
For when we haven't declared a theme variable for a property you'd like to change, an example might be that we have a background-color indicating disabled state but the consumer would like to dim the opacity.

Renderers
Let's say your design requires a different clear icon, or you find that tweaking theme and css aren't quite enough, you can provide your own component to replace ours completely.

I'll keep exploring different options.

@petejodo
Copy link

cool. I haven't heard of Glamor before. I actually completely forgot about the optional renderers. I should be able to just create my own with my own styles to get my desired result then

@JedWatson
Copy link
Owner

v2 has a complete styling API now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants