{"id":20983018,"url":"https://github.com/5tarlight/cn","last_synced_at":"2025-05-14T16:31:54.427Z","repository":{"id":257813759,"uuid":"869037130","full_name":"5tarlight/cn","owner":"5tarlight","description":"React (especially Tailwind) classname utility","archived":false,"fork":false,"pushed_at":"2024-10-23T05:44:18.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-01T12:22:57.483Z","etag":null,"topics":["classname","react","tailwindcss"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@yeahx4/cn","language":"Shell","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/5tarlight.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-10-07T15:58:35.000Z","updated_at":"2024-10-25T09:43:20.000Z","dependencies_parsed_at":"2024-10-07T16:55:14.191Z","dependency_job_id":"ab278bb0-081e-44bd-9d4a-cbca8506be30","html_url":"https://github.com/5tarlight/cn","commit_stats":null,"previous_names":["5tarlight/cn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5tarlight%2Fcn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5tarlight%2Fcn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5tarlight%2Fcn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5tarlight%2Fcn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/5tarlight","download_url":"https://codeload.github.com/5tarlight/cn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254183028,"owners_count":22028403,"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":["classname","react","tailwindcss"],"created_at":"2024-11-19T05:47:28.157Z","updated_at":"2025-05-14T16:31:54.160Z","avatar_url":"https://github.com/5tarlight.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @yeahx4/cn\n\n`@yeahx4/cn` is a lightweight utility to easily combine class names in your React projects. It helps prevent excessively long or redundant class names, particularly useful when using libraries like Tailwind CSS.\n\n## Why use @yeahx4/cn?\n\nWhen working with Tailwind CSS, class names can get very long and repetitive. `@yeahx4/cn` simplifies this by allowing you to conditionally include class names, ensuring that only valid class names are included in the final output.\n\n## Installation\n\nYou can install this package via npm:\n\n```bash\nnpm install @yeahx4/cn\n```\n\nor via yarn:\n\n```bash\nyarn add @yeahx4/cn\n```\n\n## Usage\n\nHere’s a basic example of how to use @yeahx4/cn:\n\n```tsx\nimport cn from '@yeahx4/cn';\n\nreturn (\n  \u003cbutton className={cn(\n    'btn', 'btn-primary',\n    isActive \u0026\u0026 'active',\n    disabled \u0026\u0026 'disabled')\n  }\u003e\n    Click me\n  \u003c/button\u003e\n);\n\n```\n\nIn this example:\n\n- The cn function combines the class names.\n- Conditional class names like active and disabled are only included if their corresponding conditions (isActive and disabled) are true.\n\n## Benefits\n- Simplifies managing multiple class names in Tailwind CSS.\n- Automatically filters out undefined or false values.\n- Helps make your JSX cleaner and more readable.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5tarlight%2Fcn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F5tarlight%2Fcn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5tarlight%2Fcn/lists"}