danieldelcore / trousers

hooks-first CSS-in-JS library, focused on semantics and runtime performance

Home Page:https://danieldelcore.github.io/trousers/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use css-variables instead of theme + context

danieldelcore opened this issue · comments

Variables example: https://codesandbox.io/s/elated-hooks-dnhfq

export default function App() {
  return (
    <div className="App">
      <style dangerouslySetInnerHTML={{__html: `
        .foo {
          --main-bg-color: brown;
        }
      `}} />
      <h1 className="foo" style={{
        color: 'var(--main-bg-color)',
      }}>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>
    </div>
  );
}