{"id":50354322,"url":"https://github.com/djc00p/tailwind-rails","last_synced_at":"2026-05-29T22:01:34.273Z","repository":{"id":355110744,"uuid":"1196884151","full_name":"djc00p/tailwind-rails","owner":"djc00p","description":"Tailwind CSS component patterns for Ruby on Rails ERB views. Use when building UI components in Rails, creating shared partials, implementing dark mode, writing badge/button/card/table components, or setting up a consistent design system.","archived":false,"fork":false,"pushed_at":"2026-05-01T22:06:55.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-01T23:28:21.398Z","etag":null,"topics":["ai-agent","ai-agents","ai-skill","ai-skills","rails","ruby","ruby-on-rails","skill","skills","tailwindcss"],"latest_commit_sha":null,"homepage":"https://clawhub.ai/djc00p/tailwind-rails","language":null,"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/djc00p.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-31T06:10:46.000Z","updated_at":"2026-05-01T22:06:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/djc00p/tailwind-rails","commit_stats":null,"previous_names":["djc00p/tailwind-rails"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/djc00p/tailwind-rails","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc00p%2Ftailwind-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc00p%2Ftailwind-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc00p%2Ftailwind-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc00p%2Ftailwind-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djc00p","download_url":"https://codeload.github.com/djc00p/tailwind-rails/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djc00p%2Ftailwind-rails/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33672125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"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":["ai-agent","ai-agents","ai-skill","ai-skills","rails","ruby","ruby-on-rails","skill","skills","tailwindcss"],"created_at":"2026-05-29T22:01:33.465Z","updated_at":"2026-05-29T22:01:34.266Z","avatar_url":"https://github.com/djc00p.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎨 Tailwind CSS for Rails: Design System\n\n[![ClawHub Skill](https://img.shields.io/badge/ClawHub-Skill-blue)](#) [![Agent Skill](https://img.shields.io/badge/Agent-Skill-blue)](#)\n\n**Consistent, Dark-Mode-Ready UI Components for Ruby on Rails ERB Views.**\n\nThis documentation provides a standardized library of Tailwind CSS utility patterns and ERB implementation strategies. The goal is to maintain a unified design language across all Rails applications, ensuring that every component—from badges to complex tables—is responsive, accessible, and natively supports dark mode.\n\n---\n\n## 🚀 The Core Utility: `cn()`\n\nTo prevent \"class soup\" and messy conditional logic in your ERB templates, the foundation of this design system is the `cn()` helper. This helper flattens, de-duplicates, and cleans up CSS class strings.\n\n### Implementation\n\nAdd this to your `app/helpers/application_helper.rb`:\n\n```ruby\n# app/helpers/application_helper.rb\ndef cn(*classes)\n  classes.flatten.compact.join(' ').split.uniq.join(' ')\nend\n```\n\n### Usage in ERB\n\nUse it to cleanly toggle classes based on object state:\n\n```erb\n\u003c%# Clean, readable conditional logic %\u003e\n\u003cdiv class=\"\u003c%= cn('px-4 py-2 transition-colors', active ? 'bg-blue-500 text-white' : 'bg-gray-100 text-gray-900') %\u003e\"\u003e\n  \u003c%= active ? 'Active State' : 'Inactive State' %\u003e\n\u003c/div\u003e\n```\n\n---\n\n## 🧩 Standardized Components\n\n### 1. The Badge Pattern\n\nUse these for status indicators (Success, Warning, Error, Info). Always include both light and dark mode color pairs.\n\n| Status | Light Mode | Dark Mode |\n| :--- | :--- | :--- |\n| **Success** | `bg-green-100 text-green-800` | `dark:bg-green-900 dark:text-green-100` |\n| **Warning** | `bg-yellow-100 text-yellow-800` | `dark:bg-yellow-900 dark:text-yellow-100` |\n| **Error** | `bg-red-100 text-red-800` | `dark:bg-red-900 dark:text-red-100` |\n| **Info** | ` ...blue... ` | ` ...blue... ` |\n\n**Code Snippet:**\n\n```erb\n\u003cspan class=\"inline-flex items-center rounded-full px-3 py-1 text-sm font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100\"\u003e\n  Verified\n\u003c/span\u003e\n```\n\n### 2. The Surface Card\n\nStandardized container for content blocks, featuring a subtle border and depth.\n\n```erb\n\u003cdiv class=\"rounded-lg border border-gray-20 $ dark:border-gray-800 bg-white dark:bg-gray-950 shadow-sm\"\u003e\n  \u003cdiv class=\"p-6\"\u003e\n    \u003ch3 class=\"text-lg font-semibold text-gray-900 dark:text-white\"\u003eCard Title\u003c/h3\u003e\n    \u003cp class=\"text-gray-600 dark:text-gray-400\"\u003eCard description text goes here.\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n```\n\n### 3. Responsive Data Tables\n\nA wrapper designed to handle overflow on mobile devices while maintaining a professional shadow and ring.\n\n```erb\n\u003cdiv class=\"overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg\"\u003e\n  \u003ctable class=\"min-w-full divide-y divide-gray-300 dark:divide-gray-800\"\u003e\n    \u003cthead class=\"bg-gray-50 dark:bg-gray-900\"\u003e\n      \u003c!-- Table Headers --\u003e\n    \u003c/thead\u003e\n    \u003ctbody class=\"divide-y divide-gray-200 dark:divide-gray-800\"\u003e\n      \u003c!-- Table Rows --\u003e\n    \u003c/tbody\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n```\n\n---\n\n## 📐 Design Principles \u0026 Best Practices\n\nTo maintain the integrity of this design system, all developers (and agents) should adhere to the following rules:\n\n### 🟢 Always Do\n\n* **Mobile-First:** Always write base classes for mobile, then use `sm:`, `md:`, and `lg:` prefixes to scale up.\n* **Dual-Mode Pairs:** Every color utility should be accompanied by its `dark:` counterpart (e.g., `bg-white dark:bg-gray-950`).\n* **Partial Extraction:** If a component is used more than twice, extract it into a partial (eg. `_button.html.erb`).\n* **Semantic Coloring:** Use color to convey meaning (Green = Success, Red = Error).\n\n### 🔴 Never Do\n\n* **Never use \"Class Soup\":** Avoid long, unreadable strings of classes in your ERB; always use the `cn()` helper for logic.\n* **Never ignore contrast:** Ensure that your `dark:text-gray-400` is readable against `dark:bg-gray-950`.\n* **Never skip the `cn()` helper:** Do not manually concatenate strings with `+` or `#{}` without the helper, as it leads to messy whitespace and duplicate classes.\n\n---\n\n## 🔗 Related Documentation\n\n* **[Component Library](./references/components.md)**: Full library of shared partials (Buttons, Modals, Inputs).\n* **[Dark Mode \u0026 Responsiveness](./references/dark-mode-responsive.md)**: Advanced CSS architecture and breakpoint strategies.\n\n---\n**Original implementation by [@djc00p](https://github.com/djc00p)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjc00p%2Ftailwind-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjc00p%2Ftailwind-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjc00p%2Ftailwind-rails/lists"}