{"id":13437995,"url":"https://github.com/andreypopp/react-css-components","last_synced_at":"2025-10-07T19:59:57.398Z","repository":{"id":65483002,"uuid":"55865493","full_name":"andreypopp/react-css-components","owner":"andreypopp","description":"Define React presentational components with CSS","archived":false,"fork":false,"pushed_at":"2017-03-16T10:36:21.000Z","size":519,"stargazers_count":674,"open_issues_count":6,"forks_count":14,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-09-07T16:47:10.486Z","etag":null,"topics":["css-in-js","css-modules","react","webpack"],"latest_commit_sha":null,"homepage":"","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/andreypopp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-04-09T20:27:38.000Z","updated_at":"2025-07-30T11:48:31.000Z","dependencies_parsed_at":"2023-01-25T11:15:18.244Z","dependency_job_id":null,"html_url":"https://github.com/andreypopp/react-css-components","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/andreypopp/react-css-components","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypopp%2Freact-css-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypopp%2Freact-css-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypopp%2Freact-css-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypopp%2Freact-css-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreypopp","download_url":"https://codeload.github.com/andreypopp/react-css-components/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypopp%2Freact-css-components/sbom","scorecard":{"id":194381,"data":{"date":"2025-08-11","repo":{"name":"github.com/andreypopp/react-css-components","commit":"e78e6483d16726d31903bad7a2096f4e1468f62f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":1,"reason":"Found 3/20 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 14 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T21:33:00.029Z","repository_id":65483002,"created_at":"2025-08-16T21:33:00.029Z","updated_at":"2025-08-16T21:33:00.029Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278838467,"owners_count":26054721,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["css-in-js","css-modules","react","webpack"],"created_at":"2024-07-31T03:01:02.029Z","updated_at":"2025-10-07T19:59:57.380Z","avatar_url":"https://github.com/andreypopp.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized","Code Design","JavaScript"],"sub_categories":["Uncategorized","CSS / Style"],"readme":"# React CSS components\n\n[![Join the chat at https://gitter.im/andreypopp/react-css-components](https://img.shields.io/badge/gitter-join%20chat-green.svg)](https://gitter.im/andreypopp/react-css-components)\n[![Travis build status](https://img.shields.io/travis/andreypopp/react-css-components/master.svg)](https://travis-ci.org/andreypopp/react-css-components)\n[![npm](https://img.shields.io/npm/v/react-css-components.svg)](https://www.npmjs.com/package/react-css-components)\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [Motivation](#motivation)\n- [Installation \u0026 Usage](#installation-\u0026-usage)\n- [Base components](#base-components)\n  - [DOM components](#dom-components)\n  - [Composite components](#composite-components)\n- [Variants](#variants)\n  - [Named variants](#named-variants)\n  - [JavaScript expressions](#javascript-expressions)\n- [Customizing CSS loading](#customizing-css-loading)\n  - [CSS extraction](#css-extraction)\n  - [Using with SASS/SCSS/LESS/Stylus/...](#using-with-sassscsslessstylus)\n  - [Using with PostCSS (including autoprefixer)](#using-with-postcss-including-autoprefixer)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Motivation\n\nDefine React presentational components with CSS (or even SASS or Less if you\nlike).\n\nThe implementation is based on [CSS modules][]. In fact React CSS Components is\njust a thin API on top of CSS modules.\n\n**NOTE:** The current implementation is based on Webpack but everything is ready\nto be ported onto other build systems (generic API is here just not yet\ndocumented). Raise an issue or better submit a PR if you have some ideas.\n\n## Installation \u0026 Usage\n\nInstall from npm:\n\n    % npm install react-css-components style-loader css-loader\n\nConfigure in `webpack.config.js`:\n\n```js\nmodule.exports = {\n  ...\n  module: {\n    loaders: [\n      {\n        test: /\\.react.css$/,\n        loader: 'react-css-components',\n      }\n    ]\n  }\n  ...\n}\n```\nNow you can author React components in `Styles.react.css`:\n```css\nLabel {\n  color: red;\n}\n\nLabel:hover {\n  color: white;\n}\n```\n\nAnd consume them like regular React components:\n```js\nimport {Label} from './styles.react.css'\n\n\u003cLabel /\u003e // =\u003e \u003cdiv class=\"\u003cautogenerated classname\u003e\"\u003e...\u003c/div\u003e\n```\n\n## Base components\n\n### DOM components\n\nBy default React CSS Components produces styled `\u003cdiv /\u003e` components. You can\nchange that by defining `base:` property:\n\n```css\nFancyButton {\n  base: button;\n  color: red;\n}\n```\n\nNow `\u003cFancyButton /\u003e` renders into `\u003cbutton /\u003e`:\n\n```js\nimport {FancyButton} from './styles.react.css'\n\n\u003cFancyButton /\u003e // =\u003e \u003cbutton class=\"\u003cautogenerated classname\u003e\"\u003e...\u003c/button\u003e\n```\n\n### Composite components\n\nIn fact any React component which accepts `className` props can be used as a\nbase. That means that React CSS Components can be used as theming tool for any\nUI library.\n\nExample:\n\n```css\nDangerButton {\n  base: react-ui-library/components/Button;\n  color: red;\n}\n```\n\n## Variants\n\nVariants is a mechanism which allows defining component styling variants.\n\n### Named variants\n\nYou can define additional styling variants for your components:\n\n```css\nLabel {\n  color: red;\n}\n\nLabel:emphasis {\n  font-weight: bold;\n}\n```\n\nThey are compiled as CSS classes which then can be controlled from JS via\n`variant` prop:\n\n```js\n\u003cLabel variant={{emphasis: true}} /\u003e // sets both classes with `color` and `font-weight`\n```\n### JavaScript expressions\n\nYou can define variants which are conditionally applied if JS expression against\nprops evaluates to a truthy value.\n\nExample:\n\n```css\nLabel {\n  color: red;\n}\n\nLabel:prop(mode == \"emphasis\") {\n  font-weight: bold;\n}\n```\n\nNote that any free variable references a member of `props`, thus in JS `mode`\nbecomes `props.mode` in the example above.\n\nThey are compiled as CSS classes as well. JS expressions within `prop(..)` are\nused to determine if corresponding CSS classes should be applied to DOM:\n\n```js\n\u003cLabel mode=\"emphasis\" /\u003e // sets both classes with `color` and `font-weight`\n```\n\n## Customizing CSS loading\n\nBy default React CSS components loads CSS using `style-loader!css-loader` loader\nchain. That could be configured differently using `loadCSS` loader parameter.\n\nThis could be used to enable features such as *CSS extraction*, processing\nstylesheets with *PostCSS/Autoprefixer* or even authoring stylesheets with\n*SASS* or *LESS*.\n\n### CSS extraction\n\nSee the [complete example](./examples/css-extraction/webpack.config.js) which\nconfigures\n[`extract-text-webpack-plugin`](https://github.com/webpack/extract-text-webpack-plugin)\nto extract stylesheets to a separate chunk.\n\n### Using with SASS/SCSS/LESS/Stylus/...\n\nSee the [complete example](./examples/sass/webpack.config.js) which\nuses SASS/SCSS to create React components.\n\n### Using with PostCSS (including autoprefixer)\n\nSee the [complete example](./examples/postcss//webpack.config.js) which\nconfigures PostCSS with Autoprefixer to automatically add vendor prefixes to\nstylesheets.\n\n[CSS modules]: https://github.com/css-modules/css-modules\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreypopp%2Freact-css-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreypopp%2Freact-css-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreypopp%2Freact-css-components/lists"}