GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - css-hooks/css-hooks: CSS-driven user interaction, layout context, and inherited state, all in the style prop.

BranchesTags
Open more actions menu

Latest commit

 

History

1,306 Commits
1,306 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.husky
.husky
 
 
.vscode
.vscode
 
 
docs
docs
 
 
example
example
 
 
packages
packages
 
 
scripts
scripts
 
 
site
site
 
 
test
test
 
 
.commitlintrc.json
.commitlintrc.json
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.nvmrc
.nvmrc
 
 
.prettierignore
.prettierignore
 
 
.prettierrc
.prettierrc
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
api-extractor.base.json
api-extractor.base.json
 
 
eslint.config.js
eslint.config.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
renovate.json
renovate.json
 
 
tsconfig.base.json
tsconfig.base.json
 
 
tsconfig.cjs.json
tsconfig.cjs.json
 
 

Repository files navigation

CSS Hooks

CSS Hooks CSS Hooks

tag v4.0.0-next.96 npm version license

Warning

This is the next branch, tracking the upcoming release. For the latest stable code, switch to the latest branch.

Overview

CSS power. Inline style simplicity.

Respond to user interaction, layout context, and inherited state. All CSS-driven. All without leaving the style prop. By exploiting the hidden programmability of CSS Variables, CSS Hooks delivers flexible component-owned styling without runtime style injection or build steps.

Feature highlights

User interaction

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

Layout context

<span
  style={mergeStyles(
    { display: "none" },
    on("@container (width >= 50px)", {
      display: "revert-layer",
    }),
    on("@container (width >= 100px)", {
      display: "none",
    }),
  )}
>
  sm
</span>
<span
  style={mergeStyles(
    { display: "none" },
    on("@container (width >= 100px)", {
      display: "revert-layer",
    }),
  )}
>
  lg
</span>

Inherited state

<div style={mergeStyles({ padding: 24 }, on("&:hover", enable("%active")))}>
  Hover parent
  <span
    style={mergeStyles(
      { color: "gray" },
      on("%active", {
        color: "purple",
      }),
    )}
  >
    Child responds
  </span>
</div>

Compatibility

Frameworks

React
React
Preact
Preact
Solid
Solid
Qwik
Qwik
✅ ✅ ✅ ✅

Browser support

Chrome
Chrome
Edge
Edge
Safari
Safari
Firefox
Firefox
Opera
Opera
118+
118+
18+
151+
104+

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.

About

CSS-driven user interaction, layout context, and inherited state, all in the style prop.

css-hooks.com

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

608 stars

Watchers

1 watching

Forks

8 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.