Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
AI-powered design system generator that produces complete, tailored design systems from project requirements.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/tailwind-integration.md
1# Tailwind Integration23Map design system tokens to Tailwind CSS configuration.45## CSS Variables Setup67### Base Layer89```css10/* globals.css */11@tailwind base;12@tailwind components;13@tailwind utilities;1415@layer base {16:root {17/* Primitives */18--color-blue-600: 37 99 235; /* HSL: 217 91% 60% */1920/* Semantic */21--background: 0 0% 100%;22--foreground: 222 47% 11%;23--primary: 217 91% 60%;24--primary-foreground: 0 0% 100%;25--secondary: 220 14% 96%;26--secondary-foreground: 222 47% 11%;27--muted: 220 14% 96%;28--muted-foreground: 220 9% 46%;29--accent: 220 14% 96%;30--accent-foreground: 222 47% 11%;31--destructive: 0 84% 60%;32--destructive-foreground: 0 0% 100%;33--border: 220 13% 91%;34--input: 220 13% 91%;35--ring: 217 91% 60%;36--radius: 0.5rem;37}3839.dark {40--background: 222 47% 4%;41--foreground: 210 40% 98%;42--primary: 217 91% 60%;43--primary-foreground: 0 0% 100%;44--secondary: 217 33% 17%;45--secondary-foreground: 210 40% 98%;46--muted: 217 33% 17%;47--muted-foreground: 215 20% 65%;48--accent: 217 33% 17%;49--accent-foreground: 210 40% 98%;50--destructive: 0 62% 30%;51--destructive-foreground: 0 0% 100%;52--border: 217 33% 17%;53--input: 217 33% 17%;54--ring: 217 91% 60%;55}56}57```5859## Tailwind Config6061### tailwind.config.ts6263```typescript64import type { Config } from 'tailwindcss'6566const config: Config = {67darkMode: ['class'],68content: ['./src/**/*.{ts,tsx}'],69theme: {70extend: {71colors: {72background: 'hsl(var(--background))',73foreground: 'hsl(var(--foreground))',74primary: {75DEFAULT: 'hsl(var(--primary))',76foreground: 'hsl(var(--primary-foreground))',77},78secondary: {79DEFAULT: 'hsl(var(--secondary))',80foreground: 'hsl(var(--secondary-foreground))',81},82muted: {83DEFAULT: 'hsl(var(--muted))',84foreground: 'hsl(var(--muted-foreground))',85},86accent: {87DEFAULT: 'hsl(var(--accent))',88foreground: 'hsl(var(--accent-foreground))',89},90destructive: {91DEFAULT: 'hsl(var(--destructive))',92foreground: 'hsl(var(--destructive-foreground))',93},94border: 'hsl(var(--border))',95input: 'hsl(var(--input))',96ring: 'hsl(var(--ring))',97card: {98DEFAULT: 'hsl(var(--card))',99foreground: 'hsl(var(--card-foreground))',100},101},102borderRadius: {103lg: 'var(--radius)',104md: 'calc(var(--radius) - 2px)',105sm: 'calc(var(--radius) - 4px)',106},107},108},109plugins: [],110}111112export default config113```114115## HSL Format Benefits116117Using HSL without function allows opacity modifiers:118119```tsx120// With HSL format (space-separated)121<div className="bg-primary/50"> // 50% opacity122<div className="text-primary/80"> // 80% opacity123124// CSS output125background-color: hsl(217 91% 60% / 0.5);126```127128## Component Classes129130### Button Example131132```css133@layer components {134.btn {135@apply inline-flex items-center justify-center136rounded-md font-medium137transition-colors138focus-visible:outline-none focus-visible:ring-2139focus-visible:ring-ring focus-visible:ring-offset-2140disabled:pointer-events-none disabled:opacity-50;141}142143.btn-default {144@apply bg-primary text-primary-foreground145hover:bg-primary/90;146}147148.btn-secondary {149@apply bg-secondary text-secondary-foreground150hover:bg-secondary/80;151}152153.btn-outline {154@apply border border-input bg-background155hover:bg-accent hover:text-accent-foreground;156}157158.btn-ghost {159@apply hover:bg-accent hover:text-accent-foreground;160}161162.btn-destructive {163@apply bg-destructive text-destructive-foreground164hover:bg-destructive/90;165}166167/* Sizes */168.btn-sm { @apply h-8 px-3 text-xs; }169.btn-md { @apply h-10 px-4 text-sm; }170.btn-lg { @apply h-12 px-6 text-base; }171}172```173174## Spacing Integration175176```typescript177// tailwind.config.ts178theme: {179extend: {180spacing: {181// Map to CSS variables if needed182'section': 'var(--spacing-section)',183'component': 'var(--spacing-component)',184}185}186}187```188189## Animation Tokens190191```typescript192// tailwind.config.ts193theme: {194extend: {195transitionDuration: {196fast: '150ms',197normal: '200ms',198slow: '300ms',199},200keyframes: {201'accordion-down': {202from: { height: '0' },203to: { height: 'var(--radix-accordion-content-height)' },204},205'accordion-up': {206from: { height: 'var(--radix-accordion-content-height)' },207to: { height: '0' },208},209},210animation: {211'accordion-down': 'accordion-down 0.2s ease-out',212'accordion-up': 'accordion-up 0.2s ease-out',213},214}215}216```217218## Dark Mode Toggle219220```typescript221// Toggle dark mode222function toggleDarkMode() {223document.documentElement.classList.toggle('dark')224}225226// System preference227if (window.matchMedia('(prefers-color-scheme: dark)').matches) {228document.documentElement.classList.add('dark')229}230```231232## shadcn/ui Alignment233234This configuration aligns with shadcn/ui conventions:235236- Same CSS variable naming237- Same HSL format238- Same color scale structure239- Compatible with `npx shadcn@latest add` commands240241### Using with shadcn/ui242243```bash244# Initialize (uses same token structure)245npx shadcn@latest init246247# Add components (styled with these tokens)248npx shadcn@latest add button card input249```250251Components will automatically use your design system tokens.252