Comments (7)
Hey Andy. That tends to be a common pattern but ultimately breaks style
purity of rebass components. If a user can add any style they want to a
component it's impossible for the component author to be able to change the
component knowing they won't break anything. Wrapping components may seems
like your adding superfluous divs but it's actually making your application
much more robust.
On Sat, Jan 16, 2016 at 04:28 Andy Kay [email protected] wrote:
Would it not be nice to be able to pass down classNames on components so
you don't have to wrap the components with another block just to put a
className on it?For example:
instead of:
I would be willing to submit a PR to address this if this is a legitimate
issue and not just how you explicitly designed the componentsThanks!
Andy
—
Reply to this email directly or view it on GitHub
#30.
from rebass.
Thanks that makes sense. However, say I wanted to give the Toolbar
component a white background how would I go about doing that without overriding the css?
from rebass.
You can pass color: "white"
in as a prop: https://github.com/jxnblk/rebass/blob/master/src/Toolbar.jsx#L19
from rebass.
Sorry one last question: won't the text color still be white though?
https://github.com/jxnblk/rebass/blob/master/src/Toolbar.jsx#L18
Causing a white text on white background?
from rebass.
Yep. I'd either create a PR to customize the bg-color and the text color independently or create your own toolbar component seeing as it's so simple :)
from rebass.
Ok thanks for your help Chris!
from rebass.
I generally agree with @chrislloyd on this one. Passing className
as props breaks the encapsulation of styles in the component. That said, future versions of this repo should make the components more flexible, especially in regards to colors and theming.
from rebass.
Related Issues (20)
- Is there a way for variants to inherit properties from default style? HOT 1
- Theme spacing doesn't work on the new version of emotion-theming HOT 9
- Checkbox component is broken with styled-components v5x.x HOT 3
- Is it possible to use color variables with gradients when specifying the theme HOT 1
- How can I change 'Text'(div) component to other semantic element? HOT 2
- Emotion 11 Support HOT 1
- [Question] What is the release cadence? HOT 1
- Custom breakpoints not working HOT 1
- Heading components not getting styles from theme (Emotion 11)
- Update for react 17+ HOT 7
- Is this project still maintained? HOT 10
- Typescript error when using sx prop in a Box component HOT 2
- @emotion/react ThemeProvider not working HOT 2
- Is there a way to use keyframes with Rebass? HOT 1
- Predefined styles for components conflict with custom styling HOT 1
- checkbox issue
- Style issues when clicked HOT 1
- Checkbox in label is technically invalid HOT 1
- Can I change theme CSS based on parent class?
- In-docs Voice/Text Chat 🤩
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rebass.