{"id":15503083,"url":"https://github.com/johno/style-hooks","last_synced_at":"2025-04-22T23:21:34.082Z","repository":{"id":57156065,"uuid":"156921178","full_name":"johno/style-hooks","owner":"johno","description":"[WIP] Experimenting with pure JS styles using React Hooks","archived":false,"fork":false,"pushed_at":"2018-12-13T14:13:07.000Z","size":7,"stargazers_count":9,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T17:31:13.566Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johno.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-09T21:41:29.000Z","updated_at":"2019-01-18T19:09:48.000Z","dependencies_parsed_at":"2022-08-28T18:34:23.304Z","dependency_job_id":null,"html_url":"https://github.com/johno/style-hooks","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johno%2Fstyle-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johno%2Fstyle-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johno%2Fstyle-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johno%2Fstyle-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johno","download_url":"https://codeload.github.com/johno/style-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250338495,"owners_count":21414196,"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-02T09:12:08.742Z","updated_at":"2025-04-22T23:21:34.064Z","avatar_url":"https://github.com/johno.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :flags: style-hooks\n\n\u003e CSS-in-Hooks\n\n:warning: This is an experiment with React Hooks (alpha) to implement a subset of CSS-in-JS.\nPlease don't use this in production, styled-components and emotion are much better for that.\n\n## Why?\n\nI've been pondering a lighter-weight CSS-in-JS for a while, when I saw Hooks announced it seemed like a nice new API to give it a try.\nThis is intended as a project to learn how Hooks work while scratching an itch regarding some of my dissatisfaction with existing CSS-in-JS solutions.\n\n## Goals\n\nAdd some type of generator usage so we can do something like `styled({ as: 'h1, fontSize: [12, 16, 20, 24] })`.\n\nFirstly, I'd like to continue working on this project and measuring the performance to see how it affects performance in the browser and overall bundle sizes.\n\nNatively tie into styled-system.\n\n## Installation\n\n```\nnpm i -S style-hooks react@next react-dom@next\n```\n\n## Usage\n\n```jsx\nimport Styled from 'style-hooks'\n\nconst Input = props =\u003e {\n  return (\n    \u003cStyled\n      {...props}\n      as='input'\n      style={{\n        border: 'thin solid gray',\n        focus: {\n          border: 'thin solid blue',\n          outline: 'none'\n        },\n        hover: {\n          boxShadow: '0 5px 10px rgba(0, 0, 0, .5)'\n        }\n      }}\n    /\u003e\n  )\n}\n```\n\n## Related\n\nThe following talks and projects have served as an inspiration and/or resource for this project.\n\n- https://github.com/ryanflorence/react-conf-2018\n- cxs\n- nano-style\n- styled-system\n- the-platform\n- glamor\n- emotion\n- styled-components\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohno%2Fstyle-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohno%2Fstyle-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohno%2Fstyle-hooks/lists"}