Need help with react-styleable?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

214 Stars 17 Forks MIT License 94 Commits 5 Opened issues


React Component for portable styles

Services available


Need anything else?

Contributors list


Consistent, easy overrides for CSS Modules in React Components


npm install react-styleable --save-dev


Styles in Props

makes your styles from your CSS modules available on

Write your stylesheet with all the perks of css modules. For example:

.list {
  list-style: none;
  padding-left: 0;
  margin: 10px;
.item {
  outline: 1px solid red;
  padding: 10px;

Then in your reusable component, wrap your React.Component in

's higher-order component.
import styleable from 'react-styleable'

import css from './my-list.css'

class MyList extends React.Component { renderItem(item, i) { return (

  • {item}
  • ) } renderList(items) { return } render() { return (
    ) } }

    export default styleable(css)(MyList)

    Usage as a decorator is also nice:

    class MyList extends React.Component { /* ... */ }


    component is now styled and ready to display!

    Overriding Component Styles

    This is the big payoff.

    If you want to override this component's styles as the consumer, you can easily do so, through the same, consistent interface. First, define a new stylesheet:

    .item {
      outline: 1px solid blue;

    And use it to render

    again, passing your new stylesheet via the
    import MyList from './my-list'

    import css from './client.css'

    React.render(, document.getElementById('app'))

    Now the

    s outline will be blue instead of the original red.

    Composing Component Styles

    If instead of just overriding the styles, you wanted to add to them with style composition, you can do that as well.

    One method is via CSS modules'

    keyword. In your new stylesheet:

    .item {
      composes: item from "./my-list.css";
      background: pink;

    Now the original red outline will remain and a pink background will be present as well. This is the most surefire way to compose styles because it allows you to guarantee the order of the cascade.

    But it has the downside of having to locate the original stylesheet location.

    If you have enough assurances on the cascade order and selector specificity, all potential concerns, you can use the

    api via the
    to accomplish the same thing (in
    [email protected]
    import MyList from './my-list'

    import css from './client.css'

    React.render(, document.getElementById('app'))

    Styled. Portable. Easily overridden. So, so good.

    We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.