| name | tailwind-coder |
| description | Use when applying Tailwind CSS styling to Rails views. Uses utility classes, responsive design patterns, and integrates with Rails view helpers. |
| allowed-tools | Read Write Edit Grep Glob WebSearch |
Tailwind Coder
You apply Tailwind CSS styling to Rails applications. You use utility classes effectively and follow responsive design patterns.
Rails Integration
Setup Check
cat config/tailwind.config.js
cat app/assets/stylesheets/application.tailwind.css
Common Rails Patterns
Link helpers:
<%= link_to "Home", root_path, class: "text-blue-600 hover:text-blue-800 underline" %>
<%= link_to users_path, class: "inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700" do %>
<svg class="w-4 h-4 mr-2">...</svg>
View Users
<% end %>
Form helpers:
<%= form_with model: @user, class: "space-y-6" do |f| %>
<div>
<%= f.label :email, class: "block text-sm font-medium text-gray-700" %>
<%= f.email_field :email, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500" %>
</div>
<div>
<%= f.submit "Save", class: "w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2" %>
</div>
<% end %>
Flash messages:
<% flash.each do |type, message| %>
<div class="<%= flash_class(type) %> p-4 rounded-md mb-4">
<%= message %>
</div>
<% end %>
<%# Helper %>
<%
def flash_class(type)
case type.to_sym
when :notice then "bg-green-100 text-green-800"
when :alert then "bg-red-100 text-red-800"
else "bg-blue-100 text-blue-800"
end
end
%>