# styling

Rule for consistent React component styling: semantic color tokens instead of raw Tailwind values, built-in component variants, conditional classes via cn(). Prevents improper Tailwind usage and ensures light and dark theme support.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 7523 repo stars
- Author: Devin-AXIS
- License: LicenseRef-Proprietary · policy=link-only · description only; the file stays with the author
- Source: https://github.com/Devin-AXIS/iPolloWork/tree/HEAD/.opencode/skills/shadcn/rules/styling.md
- Updated: 2026-10-29
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/devin-axis-styling

## What it does

This rule enforces styling conventions for UI: use semantic tokens (`bg-primary`, `text-muted-foreground`) rather than literal colors like `bg-blue-500`, prefer component variants (`variant="outline"`) over manual class overrides, apply `className` only for layout (`max-w-md`, `gap-4`), not colors or typography.

Key requirements: replace `space-x-*` and `space-y-*` with `gap-*`, use `size-10` instead of `w-10 h-10`, prefer `truncate` to the full set `overflow-hidden text-ellipsis whitespace-nowrap`, write conditional classes through `cn()` from `@/lib/utils`, never add `z-index` to overlays (`Dialog`, `Sheet`, `Drawer`).

Common mistake: hard-coded status and indicator colors. Instead of `text-red-600` for error, use `text-destructive` or a `Badge` variant. When a needed token is missing, suggest adding a CSS variable to `customization.md` rather than reaching for a raw color.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/styling.md` — The paths frontmatter field limits the files

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/styling.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/styling.instructions.md` — The applyTo field sets which files it applies to

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/styling.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/styling.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Devin-AXIS/iPolloWork/tree/HEAD/.opencode/skills/shadcn/rules/styling.md

## When to use it
- pick a semantic color token instead of a hard-coded Tailwind value
- add a conditional class without ternary inside className string
- replace element spacing from `space-*` to `gap`
- override component styling with built-in variant
- align styles across light and dark themes without manual `dark:` prefixes

## Example prompts
- Replace the background color with `bg-primary`—this rule blocks raw `bg-blue-500`
- How do I customize colors for my brand? Check `customization.md` and add a CSS variable
- Change `space-y-4` to `flex flex-col gap-4` for me

## Similar
- [ui-styling](https://affpapa.org/en/nevibecode/rules/ui-styling.md) — rule · ★ 1216 repo stars
- [preline-theme-generator](https://affpapa.org/en/nevibecode/skills/preline-theme-generator.md) — skill · 1400 installs
- [refactoring-ui](https://affpapa.org/en/nevibecode/skills/refactoring-ui.md) — skill · 10500 installs
- [design-style-installer](https://affpapa.org/en/nevibecode/skills/design-style-installer.md) — skill · 105 installs
- [tailwind-4](https://affpapa.org/en/nevibecode/skills/tailwind-4.md) — skill · 617 installs
- [UISandbox](https://affpapa.org/en/nevibecode/mcp/uisandbox.md) — MCP server · ★ 7 repo stars

## Other versions with the same name
- [styling · calesthio](https://affpapa.org/en/nevibecode/rules/styling.md) — ★ 78316 repo stars
- [styling · maxtrigify](https://affpapa.org/en/nevibecode/rules/maxtrigify-styling.md) — ★ 141 repo stars

From the same set: [devin-axis/ipollowork](https://affpapa.org/en/nevibecode/by/devin-axis/ipollowork.md) — 42 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
