{"id":18654972,"url":"https://github.com/ethworks/bem-components-react","last_synced_at":"2025-04-11T17:31:47.631Z","repository":{"id":43990582,"uuid":"241369916","full_name":"EthWorks/bem-components-react","owner":"EthWorks","description":"A factory to create react components that follow BEM methodology with first-class typescript support.","archived":false,"fork":false,"pushed_at":"2022-02-13T01:45:36.000Z","size":351,"stargazers_count":13,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T01:01:59.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EthWorks.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":"2020-02-18T13:37:49.000Z","updated_at":"2021-11-22T20:19:58.000Z","dependencies_parsed_at":"2022-08-25T06:00:39.328Z","dependency_job_id":null,"html_url":"https://github.com/EthWorks/bem-components-react","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EthWorks%2Fbem-components-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EthWorks%2Fbem-components-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EthWorks%2Fbem-components-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EthWorks%2Fbem-components-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EthWorks","download_url":"https://codeload.github.com/EthWorks/bem-components-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248449824,"owners_count":21105568,"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-11-07T07:17:16.671Z","updated_at":"2025-04-11T17:31:44.310Z","avatar_url":"https://github.com/EthWorks.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bem-components-react\n\nA factory to create react components that follow BEM methodology with first-class typescript support.\n\n## Getting started\n\nInstallation:\n\n```\n  yarn add bem-components-react\n\n  npm install --save bem-components-react\n```\n\nUsage:\n\n```jsx\nimport { bem } from 'bem-components-react'\n\n// specify a class name and a list of variants afterwards\nconst Button = bem.button('button', ['large', 'small']) \n\nfunction MyComponent() {\n  return \u003cButton large\u003eClick me\u003c/Button\u003e\n}\n\n```\n\nThis component will render to:\n\n```html\n\u003cbutton class=\"button button--large\"\u003eClick me\u003c/button\u003e\n```\n\n### API\n\n```jsx\n// omit the second argument if the component doesn't have any modifiers\nconst Button = bem.button('button')\n\n// specify an array of variants as a second argument\nconst Button = bem.button('button', ['large', 'small']) \n\n// nest elements inside blocks by specifying it in the name\nconst Input = bem.button('dialog__input', ['error'])\n\n// to enable a variant, pass a prop to the created component\n\u003cButton large\u003eClick me\u003c/Button\u003e\n\n// you can pass any other prop to the created component\n\u003cInput error placeholder=\"write here\"/\u003e\n\n// you can pass extra classNames to the component\n\u003cButton large className=\"foo\"\u003eClick me\u003c/Button\u003e\n// will result in\n\u003cbutton classname=\"button button--large foo\"\u003eClick me\u003c/button\u003e\n```\n\n### Using a custom prefix for classes\n\n```jsx\nimport { withPrefix } from 'bem-components-react'\nconst bem = withPrefix('myapp')\n\nconst Button = bem.button('button', ['large', 'small']) \n```\n\nWill render to:\n\n```html\n\u003cbutton class=\"myapp-button myapp-button--large\"\u003eClick me\u003c/button\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethworks%2Fbem-components-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethworks%2Fbem-components-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethworks%2Fbem-components-react/lists"}