{"id":16039545,"url":"https://github.com/mh-jsx/tw-classnames","last_synced_at":"2026-05-08T06:46:39.004Z","repository":{"id":213800851,"uuid":"707652111","full_name":"mh-jsx/tw-classnames","owner":"mh-jsx","description":"A lightweight utility function that simplifies the process of merging Tailwind Classes","archived":false,"fork":false,"pushed_at":"2023-10-23T05:17:07.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T09:04:14.862Z","etag":null,"topics":["classname","classnames","javascript","javascript-library","merge","npm","npm-package","tailwind","tailwind-css","tailwindcss","utilities","utility"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tw-classnames","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/mh-jsx.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-20T11:09:58.000Z","updated_at":"2023-10-20T16:48:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"b01ff803-b982-4e7f-99c3-81891a4273ef","html_url":"https://github.com/mh-jsx/tw-classnames","commit_stats":null,"previous_names":["mh-jsx/tw-classnames"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mh-jsx%2Ftw-classnames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mh-jsx%2Ftw-classnames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mh-jsx%2Ftw-classnames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mh-jsx%2Ftw-classnames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mh-jsx","download_url":"https://codeload.github.com/mh-jsx/tw-classnames/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246981156,"owners_count":20863825,"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","classnames","javascript","javascript-library","merge","npm","npm-package","tailwind","tailwind-css","tailwindcss","utilities","utility"],"created_at":"2024-10-08T23:05:19.141Z","updated_at":"2025-10-11T10:05:14.113Z","avatar_url":"https://github.com/mh-jsx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tailwind Classnames\n\n![npm](https://img.shields.io/npm/v/tw-classnames) ![npm](https://img.shields.io/npm/dt/tw-classnames) ![NPM](https://img.shields.io/npm/l/tw-classnames)\n\n`twc` aka tw-classnames is a lightweight utility function that simplifies the process of merging Tailwind Classes while also supporting conditional classes within objects.\n\n## Installation\n\nYou can install `twc` via npm or yarn:\n\n```bash\nnpm install tw-classnames\n# OR\nyarn add tw-classnames\n```\n\n\n\u003cbr /\u003e\n\n## Usage\nImport twc into your JavaScript or TypeScript code:\n\n```javascript\nconst twc = require('tw-classnames');\n// OR\nimport twc from 'tw-classnames';\n```\n\u003cbr /\u003e\n\n## Merging Duplicate Classnames\ntwc allows you to smartly merge duplicate Tailwind classes.\n\n````javascript\nconst mergedClasses = twc('bg-blue', 'text-white', 'p-4', 'bg-green');\nconsole.log(mergedClasses);\n// Output: 'text-white p-4 bg-green'\n````\n\n\u003cbr /\u003e\n\n## Conditional Classes\ntwc supports conditional classes within objects. This is especially useful when you want to apply different classes based on certain conditions.\n\n````javascript\nconst isActive = true;\nconst classes = twc('bg-blue-500', 'text-white', { 'font-bold': isActive });\nconsole.log(classes);\n// Output: 'bg-blue-500 text-white font-bold'\n````\n\n\u003cbr /\u003e\n\n\n### Dependency Libraries\n\n`twc` internally uses two popular libraries:\n- [clsx](https://www.npmjs.com/package/clsx) for object merging.\n- [tailwind-merge](https://www.npmjs.com/package/tailwind-merge) to merge Tailwind classes intelligently.\n\n\n## License\n\n`twc` is open-source and released under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmh-jsx%2Ftw-classnames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmh-jsx%2Ftw-classnames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmh-jsx%2Ftw-classnames/lists"}