{"id":23190437,"url":"https://github.com/felipstein/classify-react","last_synced_at":"2025-04-05T06:41:58.883Z","repository":{"id":232479621,"uuid":"784465816","full_name":"Felipstein/classify-react","owner":"Felipstein","description":"Utility library designed to simplify the handling of multi Elements/Components in React Component.","archived":false,"fork":false,"pushed_at":"2024-04-10T03:43:34.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-23T22:52:40.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/classify-react","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/Felipstein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2024-04-09T22:53:55.000Z","updated_at":"2024-04-10T02:47:18.000Z","dependencies_parsed_at":"2024-04-10T04:41:00.967Z","dependency_job_id":"efe8a952-2713-4eb0-9834-831d96be0eb3","html_url":"https://github.com/Felipstein/classify-react","commit_stats":null,"previous_names":["felipstein/react-classname","felipstein/classify-react"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Felipstein%2Fclassify-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Felipstein%2Fclassify-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Felipstein%2Fclassify-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Felipstein%2Fclassify-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Felipstein","download_url":"https://codeload.github.com/Felipstein/classify-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299792,"owners_count":20916186,"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-12-18T12:14:28.727Z","updated_at":"2025-04-05T06:41:58.867Z","avatar_url":"https://github.com/Felipstein.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `classify-react`\n`classify-react` is a utility library designed to simplify the handling of multi Elements/Components in React Component. It offers a streamlined way to assign class names to different parts of a componente based on props, reducing the boilerplate and improving readability.\n\n## Installation\n\nUsing npm\n```bash\nnpm install classify-react\n```\n\nUsing yarn\n```bash\nyarn add classify-react\n```\n\nUsing pnpm\n```bash\npnpm add classify-react\n```\n\n## Usage\n\n`classify-react` allows you to easily manage class names for you component's elements in a more concise and readable manner. Here's how you can use it:\n```tsx\nimport { buildClassNames } from 'classify-react';\n\ninterface Props {\n  className?: string | { root?: string, input?: string }\n}\n\nfunction Component({ className }: Props) {\n  const getClassName = buildClassNames(className);\n\n  return (\n    \u003cdiv className={getClassName('root')}\u003e\n      \u003cinput className={getClassName('input')} /\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n### Default Key\n\nWhen passing a string directly to the `className` prop, you might want it to be applied to a specific part of your component by default (e.g., the root element). `classify-react` supports this through a `defaultKey` parameter in the `buildClassNames` function, allowing you to specify which key should be used for string class names:\n```ts\nconst getClassName = buildClassNames(className, 'root');\n```\n\nIn this example, if `className` is a string, it will be applied to the `'root'` element of the component.\n\n## Features\n\n- **Simplified Class Name Management**: Easily manage multiple class names and conditional class assignments within your React Components.\n- **Reduces Boilerplate**: Avoid repetitive code for handling conditional class names.\n- **Enhanced Readability**: Makes it clearer which class names are applied to different parts of your component.\n- **Default Key Support**: Specify a default key for string class names, simplifying the common case of a single class name applied to the component root.\n\n## Contributing\n\nYou're welcome to contribute to `classify-react` and help me improve it. Please check out the [CONTRIBUTING.md](https://github.com/felipstein/classify-react/blob/master/CONTRIBUTING.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipstein%2Fclassify-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelipstein%2Fclassify-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipstein%2Fclassify-react/lists"}