Giter Club home page Giter Club logo

Comments (7)

chrislloyd avatar chrislloyd commented on May 13, 2024

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 components

Thanks!

Andy


Reply to this email directly or view it on GitHub
#30.

from rebass.

swolidity avatar swolidity commented on May 13, 2024

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.

chrislloyd avatar chrislloyd commented on May 13, 2024

You can pass color: "white" in as a prop: https://github.com/jxnblk/rebass/blob/master/src/Toolbar.jsx#L19

from rebass.

swolidity avatar swolidity commented on May 13, 2024

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.

chrislloyd avatar chrislloyd commented on May 13, 2024

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.

swolidity avatar swolidity commented on May 13, 2024

Ok thanks for your help Chris!

from rebass.

jxnblk avatar jxnblk commented on May 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.