{"id":17084525,"url":"https://github.com/nsaunders/css-hooks-basic","last_synced_at":"2026-05-21T13:30:17.542Z","repository":{"id":223867737,"uuid":"761260741","full_name":"nsaunders/css-hooks-basic","owner":"nsaunders","description":"A simplified CSS Hooks API for basic use cases","archived":true,"fork":false,"pushed_at":"2024-04-07T14:56:42.000Z","size":125,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-18T18:45:08.528Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nsaunders.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-21T14:40:34.000Z","updated_at":"2024-12-12T22:33:52.000Z","dependencies_parsed_at":"2024-02-22T14:05:41.613Z","dependency_job_id":"f095e877-e1cc-44db-996b-24fe0f4d35d2","html_url":"https://github.com/nsaunders/css-hooks-basic","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":0.2222222222222222,"last_synced_commit":"709b4aa14dda06bdc0ff2734d45ec559932000ea"},"previous_names":["nsaunders/css-hooks-basic"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsaunders%2Fcss-hooks-basic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsaunders%2Fcss-hooks-basic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsaunders%2Fcss-hooks-basic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsaunders%2Fcss-hooks-basic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nsaunders","download_url":"https://codeload.github.com/nsaunders/css-hooks-basic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240131743,"owners_count":19752725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T13:07:36.900Z","updated_at":"2026-05-21T13:30:17.232Z","avatar_url":"https://github.com/nsaunders.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# css-hooks-basic\n\nThis is a utility library for simplifying the usage of\n[CSS Hooks](https://css-hooks.com), providing a basic API for styling components\nwithout advanced conditions.\n\n## Installation\n\n```bash\nnpm install css-hooks-basic\n```\n\n## Usage\n\n### Option 1: Global `css` function\n\nIf you prefer to avoid using advanced conditions (the `on` field) entirely, you\ncan convert your global `css` function to use the basic API provided by this\nlibrary:\n\n1. Import the `basic` function in your CSS module.\n2. Apply it to the `css` function produced by `createHooks`.\n3. Export the resulting function as `css`.\n\n```typescript\n// src/css.ts\n\nimport { createHooks } from \"@css-hooks/react\";\nimport { basic } from \"css-hooks-basic\";\n\nconst { styleSheet, css: cssAdvanced } = createHooks({\n  // ...configuration...\n});\n\nexport { styleSheet };\n\nexport const css = basic(cssAdvanced);\n```\n\nNow, you can use the basic version of the `css` function throughout your\nproject, providing an easier way to define styles.\n\n### Option 2: Case by case\n\nAlternatively, you can use the basic API on a case-by-case basis. This allows\nyou to mix basic and advanced styling conditions according to your needs.\n\nIn a component module, simply import `css` from your CSS module and the `basic`\nfunction from css-hooks-basic; and then use them together to style your\ncomponent:\n\n```tsx\n// src/easy-button.tsx\n\nimport { css } from \"./css\";\nimport { basic } from \"css-hooks-basic\";\n\nexport const EasyButton = () =\u003e (\n  \u003cbutton\n    style={basic(css)({\n      color: \"black\",\n      \"\u0026:enabled\": {\n        \"\u0026:hover\": {\n          color: \"blue\",\n        },\n        \"\u0026:active\": {\n          color: \"red\",\n        },\n      },\n      \"\u0026:disabled\": {\n        color: \"gray\",\n      },\n    })}\n  \u003e\n    Easy\n  \u003c/button\u003e\n);\n```\n\nWith this approach, you have the flexibility to choose between basic and\nadvanced styling conditions for different components as needed.\n\n## Contributing\n\nContributions to css-hooks-basic are welcome! If you find any issues or have\nsuggestions for improvements, please open an issue or submit a pull request on\nthe GitHub repository.\n\n## License\n\ncss-hooks-basic is licensed under the MIT License. See the LICENSE file for\ndetails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsaunders%2Fcss-hooks-basic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnsaunders%2Fcss-hooks-basic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsaunders%2Fcss-hooks-basic/lists"}