IssueRaiser

Contextual Overrides / Theming Proposal

Contextual Overrides / Theming Proposal There have been a series of discussions on this issue tracker and on other projects about the interrelated issues of **Contextual Overrides** (i.e. how can an outer component change the CSS of an inner one?) and **Theming** (i.e. how to publish a reusable component & let the consumer style it to fit with their app?). There have been several promising proposals about how to deal with this, so I want to take an overarching look at the problem and propose a solution. ## Contextual Overrides There's a great discussion dating back to August last year at #40 which presents the use-case of overriding a the width of a child component `.card` inside a parent component `.row` and a bunch of potential solutions. There's an earlier one #21 that tries to reconcile something like Bootstrap's `.buttonGroup` changing the appearance of a `.button` and how that might be possible in CSS Modules. More recently, there's been a discussion in https://github.com/gajus/react-css-modules/issues/94 leading to proposal #139 to allow an explicit method of importing a compiled class from another file in order to change it. There's a lot of good points being made and it's worth reading through the use cases. There's also a non-CSS-modules [summary of approaches](http://simurai.com/blog/2015/05/11/nesting-components?utm_content=bufferd8aa5&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer) by Simuari that's well worth reading. The prevailing wisdom is th

Posted by geelen on May 5, 2016, 9:51 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.5,000 issues0 comments

github (SaaS)

Contextual Overrides / Theming Proposal

geelenMay 5, 2016, 9:51 PM

Contextual Overrides / Theming Proposal There have been a series of discussions on this issue tracker and on other projects about the interrelated issues of **Contextual Overrides** (i.e. how can an outer component change the CSS of an inner one?) and **Theming** (i.e. how to publish a reusable component & let the consumer style it to fit with their app?). There have been several promising proposals about how to deal with this, so I want to take an overarching look at the problem and propose a solution. ## Contextual Overrides There's a great discussion dating back to August last year at #40 which presents the use-case of overriding a the width of a child component `.card` inside a parent component `.row` and a bunch of potential solutions. There's an earlier one #21 that tries to reconcile something like Bootstrap's `.buttonGroup` changing the appearance of a `.button` and how that might be possible in CSS Modules. More recently, there's been a discussion in https://github.com/gajus/react-css-modules/issues/94 leading to proposal #139 to allow an explicit method of importing a compiled class from another file in order to change it. There's a lot of good points being made and it's worth reading through the use cases. There's also a non-CSS-modules [summary of approaches](http://simurai.com/blog/2015/05/11/nesting-components?utm_content=bufferd8aa5&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer) by Simuari that's well worth reading. The prevailing wisdom is th

Comments (0)

No comments yet. Start the discussion.

Comment on this issue