---
name: tailwind-css-component-builder
description: "Delivers a production-ready Tailwind component for the framework you use: mobile-first classes, real hover and focus states, a dark variant, and markup that passes a copy-paste test without cleanup. Use when you need a responsive Tailwind component such as a navbar, hero, card, or modal written in your framework's syntax and ready to paste. Do not use for styling an existing component you already wrote, or setting up Tailwind and its config in a project. Related topics: coding, frontend, tailwind."
---

# Tailwind CSS Component Builder

Delivers a production-ready Tailwind component for the framework you use: mobile-first classes, real hover and focus states, a dark variant, and markup that passes a copy-paste test without cleanup.

## When to use

Use this skill when you need a responsive Tailwind component such as a navbar, hero, card, or modal written in your framework's syntax and ready to paste. Do not use it for styling an existing component you already wrote, or setting up Tailwind and its config in a project.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Lay out the mobile base markup with flex or grid utilities and semantic tags; it renders correctly with no breakpoint prefixes.
3. Add responsive classes only at the requested breakpoints, each one changing the layout for a stated reason.
4. Attach hover and focus-visible states to every interactive element and a dark: variant to every color class when requested.
5. Translate the markup into the chosen framework syntax and wire the minimal state so modals and menus work as pasted.
6. List the notes: breakpoint changes, state included, and any class that differs between Tailwind versions.

## Inputs

- **Component type** (choose one: Navigation bar, Hero section, Card, Modal, Form, Table, Sidebar, Footer, Pricing table, Testimonial, Other)
- **What it should look like and contain** (longer free text)
- **Color scheme** (choose one: Default Tailwind palette, Custom brand colors, Dark mode only, Light mode only, Follows system preference)
- **Brand colors if custom** (free text, e.g. "primary #1E40AF and accent #F59E0B")
- **Mobile-first** (choose one: Yes, No)
- **Breakpoints to support** (choose any: sm (640px), md (768px), lg (1024px), xl (1280px), 2xl (1536px))
- **Add hover and focus states** (choose one: Yes, No)
- **Include dark mode variant** (choose one: Yes, No)
- **Add animation classes** (choose one: Yes, No)
- **Framework** (choose one: Plain HTML, React JSX, Vue template, Svelte)
- **Tailwind version** (choose one: v4, v3, Not sure)

## Output

One code block with the complete component in the chosen framework syntax, followed by a short notes list covering breakpoints, state, and version-specific classes.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### Tailwind CSS Component Builder

Build the component described below with Tailwind utility classes.

- Component type: {{Component type}}
- What it should look like and contain: {{What it should look like and contain}}
- Color scheme: {{Color scheme}}
- Brand colors if custom: {{Brand colors if custom}}
- Mobile-first: {{Mobile-first}}
- Breakpoints to support: {{Breakpoints to support}}
- Add hover and focus states: {{Add hover and focus states}}
- Include dark mode variant: {{Include dark mode variant}}
- Add animation classes: {{Add animation classes}}
- Framework: {{Framework}}
- Tailwind version: {{Tailwind version}}

Start from the mobile layout and add classes only at the breakpoints requested, so the base markup is the smallest screen. Use flex or grid utilities for structure rather than fixed widths and margins. Give every interactive element visible hover and focus-visible states and the right semantic tag (button, nav, a, form controls with labels) so keyboard users and screen readers get it free. When dark mode is requested, pair each color class with a dark: variant rather than a second copy of the markup. For custom brand colors, use arbitrary values or theme tokens and say which. Keep animations to transition and transform utilities so they work without extra CSS.

Write the output in the chosen framework's syntax: className and self-closing tags for React, v-bind and v-for for Vue, each loop and bind for Svelte. Where the component needs state (an open modal, a mobile menu), include the minimal state hook or script so it works as pasted.

### Output
Return the full component in one code block in the chosen framework syntax, then a short list of notes: which breakpoints change the layout, any state wired in, and any class that depends on the Tailwind version.

## Pitfalls

- Writing desktop classes as the base and overriding them downward, which fights Tailwind's mobile-first breakpoints.
- Using div with onClick for buttons and links, which loses keyboard access and focus styles.
- Shipping a modal or mobile menu with no state, so the pasted component cannot open or close.
- Using v3-only utilities such as bg-opacity-50 in a v4 project where they no longer compile.
