MCPcopy Index your code
hub / github.com/css-hooks/css-hooks

github.com/css-hooks/css-hooks @v3.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.1.2 ↗ · + Follow
110 symbols 307 edges 52 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CSS Hooks

<a href="https://css-hooks.com#gh-light-mode-only"><img alt="CSS Hooks" src="https://github.com/css-hooks/css-hooks/raw/v3.1.2/github/wordmark-dark.svg" width="256"></a>
<a href="https://css-hooks.com#gh-dark-mode-only"><img alt="CSS Hooks" src="https://github.com/css-hooks/css-hooks/raw/v3.1.2/github/wordmark-light.svg" width="256"></a>

tag v3.1.2 npm version license


Overview

Hooks add CSS features to native inline styles, enabling you to apply styles conditionally based on pseudo-classes, custom selectors, media queries, and more—all without leaving the style prop. By exploiting the hidden programmability of CSS Variables, CSS Hooks delivers a flexible CSS-in-JS experience without runtime style injection or build steps.

Feature highlights

Pseudo-classes

<button
  style={pipe(
    {
      background: "#004982",
      color: "#eeeff0",
    },
    on("&:hover", {
      background: "#1b659c",
    }),
    on("&:active", {
      background: "#9f3131",
    }),
  )}
>
  Save changes
</button>

Selectors

<label>
  <input type="checkbox" checked />
  <span
    style={pipe(
      {},
      on(":checked + &", {
        textDecoration: "line-through",
      }),
    )}
  >
    Simplify CSS architecture
  </span>
</label>

Responsive design

<>
  <span
    style={pipe(
      {},
      on(not("@container (width < 400px)"), {
        display: "none",
      }),
    )}
  >
    sm
  </span>
  <span
    style={pipe(
      {},
      on("@container (width < 400px)", {
        display: "none",
      }),
    )}
  >
    lg
  </span>
</>

Compatibility

Framework integrations

| React

React | Preact

Preact | Solid

Solid | Qwik

Qwik | | :--------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------: | | ✅ | ✅ | ✅ | ✅ |

Browser support

| Chrome

Chrome | Edge

Edge | Safari

Safari | Firefox

Firefox | Opera

Opera | | :-----------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------: | | 99+ | 99+ | 15.4+ | 97+ | 85+ |

Documentation

Please visit css-hooks.com to get started.

Contributing

Contributions are welcome. Please see the contributing guidelines for more information.

License

CSS Hooks is offered under the MIT license.

Extension points exported contracts — how you extend this code

ThemeSwitcherProps (Interface)
(no doc)
example/src/theme-switcher.tsx
CreateHooksResult (Interface)
(no doc)
packages/core/src/index.ts

Core symbols most depended-on inside this repo

on
called by 161
packages/core/src/index.ts
withAlpha
called by 30
site/src/css.ts
buildHooksSystem
called by 10
packages/core/src/index.ts
createHash
called by 10
packages/core/src/index.ts
merge
called by 10
site/src/css.ts
styleSheet
called by 9
packages/core/src/index.ts
color
called by 9
site/src/design/colors.ts
warm
called by 6
example/src/app.tsx

Shape

Function 108
Interface 2

Languages

TypeScript100%

Modules by API surface

site/src/routes/home.tsx20 symbols
site/src/components/icons.tsx10 symbols
site/src/routes/doc.tsx8 symbols
example/src/theme-switcher.tsx7 symbols
site/src/root.tsx6 symbols
packages/core/src/index.ts6 symbols
packages/core/src/index.test.ts6 symbols
site/src/css.ts5 symbols
scripts/calculate-version/main.ts4 symbols
site/src/rehype.ts3 symbols
site/src/data/meta.ts3 symbols
site/src/components/syntax-highlighter.tsx3 symbols

For agents

$ claude mcp add css-hooks \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact