100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.
Tailwind Plus: Utility-First for Semantic Components
The Hybrid Approach
Combine the best of both worlds:
- Tailwind's utility-first CSS for rapid layout and styling
- Our semantic components for complex interactive patterns
What Would Be Required
1. Utility Class System for Component Styling
Size Utilities:
<semantic-action intent="primary" class="w-full h-12 text-lg">
<semantic-action intent="primary" class="w-auto px-6 py-3">
<semantic-action intent="primary" class="min-w-[200px] max-w-md">
Spacing Utilities:
<semantic-action class="m-4 p-2">
<semantic-card class="mt-8 mb-4 px-6 py-4">
<semantic-input class="my-2 mx-auto">
Layout Utilities:
<div class="flex items-center gap-4">
<semantic-action intent="primary">Save</semantic-action>
<semantic-action intent="secondary">Cancel</semantic-action>
</div>
<div class="grid grid-cols-3 gap-4">
<semantic-card>...</semantic-card>
<semantic-card>...</semantic-card>
<semantic-card>...</semantic-card>
</div>
Typography Utilities (for slotted content):
<semantic-card class="text-center">
<h2 class="text-2xl font-bold mb-2">Title</h2>
<p class="text-gray-600 text-sm">Description</p>
</semantic-card>
Visual Override Utilities:
<semantic-action intent="primary" class="opacity-75 shadow-lg rounded-lg">
<semantic-card class="bg-gradient-to-r from-blue-500 to-purple-600">
<semantic-input class="border-2 border-blue-500 focus:ring-4">
2. Component-Specific Utility Patterns
Intent Composition:
<!-- Instead of just intent="primary", compose behaviors -->
<semantic-action
intent="primary"
sentiment="constructive"
urgency="high"
class="attention-critical">
State Utilities:
<semantic-action class="disabled:opacity-50 hover:scale-105 active:scale-95">
<semantic-input class="valid:border-green-500 invalid:border-red-500">
<semantic-card class="expanded:shadow-2xl collapsed:shadow-sm">
Responsive Component Behavior:
<!-- Change intent based on screen size -->
<semantic-action
class="md:intent-primary sm:intent-secondary"
class="mobile:full-width desktop:inline-flex">
3. Layout Components with Utility Classes
Stack/Flex Containers:
<semantic-stack direction="vertical" spacing="4" class="p-6 bg-white rounded-lg">
<semantic-action intent="primary">Button 1</semantic-action>
<semantic-action intent="secondary">Button 2</semantic-action>
</semantic-stack>
<semantic-stack direction="horizontal" spacing="2" class="justify-between items-center">
<span>Label</span>
<semantic-switch></semantic-switch>
</semantic-stack>
Grid Layouts:
<semantic-grid cols="3" gap="4" class="p-8">
<semantic-card>Card 1</semantic-card>
<semantic-card>Card 2</semantic-card>
<semantic-card>Card 3</semantic-card>
</semantic-grid>
Responsive Containers:
<semantic-container class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<!-- Content adapts to container -->
</semantic-container>
4. Advanced Utility Patterns
Composition Classes:
<!-- Pre-defined component combinations -->
<semantic-action class="btn-cta">
<!-- Equivalent to: intent="primary" sentiment="constructive" urgency="critical" + specific styling -->
</semantic-action>
<semantic-card class="card-pricing">
<!-- Pre-configured for pricing display -->
</semantic-card>
Animation Utilities:
<semantic-modal class="animate-slide-up duration-300 ease-out">
<semantic-toast class="animate-fade-in-out delay-3000">
<semantic-action class="transition-all duration-200 hover:translate-y-[-2px]">
Dark Mode Utilities:
<semantic-card class="bg-white dark:bg-gray-800 text-gray-900 dark:text-white">
<semantic-action class="shadow-sm dark:shadow-blue-500/50">
5. What Makes This "Plus"
A. Enhanced Component Utilities
Attention Budget Classes:
.attention-critical /* Red zone: Maximum visual weight */
.attention-high /* Orange zone: Important but not critical */
.attention-medium /* Yellow zone: Normal priority */
.attention-low /* Green zone: Minimal visual weight */
.attention-minimal /* Blue zone: Barely visible */
Context-Aware Classes:
.adapt-mobile /* Optimize for mobile automatically */
.adapt-desktop /* Optimize for desktop automatically */
.adapt-touch /* Larger touch targets, simplified interactions */
.adapt-precision /* Smaller targets OK, more density */
Modality Classes:
.voice-enabled /* Make component voice-controllable */
.gesture-enabled /* Enable swipe, pinch, etc. */
.keyboard-priority /* Optimize for keyboard navigation */
B. Smart Defaults with Overrides
Components come with smart defaults, utilities override when needed:
<!-- Default: Adapts automatically -->
<semantic-action intent="primary">Save</semantic-action>
<!-- Override: Force specific behavior -->
<semantic-action intent="primary" class="w-full touch:h-14 mouse:h-10">
Save
</semantic-action>
C. CSS Custom Property Utilities
Expose component internals via utilities:
<semantic-action
class="[--action-bg:#custom-color] [--action-radius:12px] [--action-shadow:custom]">
6. Implementation Strategy
Phase 1: Core Integration
- Allow standard Tailwind utilities on component hosts
- Ensure utility classes work with shadow DOM
- Create bridge between utilities and component CSS custom properties
Phase 2: Component-Specific Utilities
- Generate utilities for each component's attributes
- Create variant modifiers (hover:, focus:, disabled:, etc.)
- Build responsive variants (sm:, md:, lg:, xl:)
Phase 3: Advanced Utilities
- Attention budget utilities
- Context-aware utilities
- Modality-specific utilities
- Animation and transition utilities
Phase 4: Composition Patterns
- Pre-built component combinations
- Common patterns as single classes
- Design system tokens
7. Technical Requirements
Build Pipeline:
// generate-tailwind-plus.js
const components = [
'semantic-action',
'semantic-card',
'semantic-input',
// ... all components
];
// Generate:
// 1. Tailwind plugin for component utilities
// 2. CSS custom property mappings
// 3. TypeScript definitions
// 4. Documentation
Tailwind Plugin:
// tailwind.config.js
module.exports = {
plugins: [
require('./semantic-components-plugin'),
],
theme: {
extend: {
// Component-specific theme values
}
}
}
Shadow DOM Bridge:
// Utility classes on host → CSS custom properties in shadow DOM
class SemanticAction extends HTMLElement {
connectedCallback() {
// Read utility classes, set custom properties
this.syncUtilitiesToCustomProps();
}
}
8. Example: Complete Page with Tailwind Plus
<!DOCTYPE html>
<html>
<head>
<script src="semantic-components.js"></script>
<link href="tailwind-plus.css" rel="stylesheet">
</head>
<body class="bg-gray-50 dark:bg-gray-900">
<semantic-container class="max-w-7xl mx-auto px-4 py-8">
<!-- Header -->
<header class="flex justify-between items-center mb-8">
<h1 class="text-3xl font-bold text-gray-900 dark:text-white">
Dashboard
</h1>
<semantic-action intent="primary" class="px-6">
New Project
</semantic-action>
</header>
<!-- Grid of Cards -->
<semantic-grid cols="3" gap="6" class="mb-8">
<semantic-card class="p-6 hover:shadow-xl transition-shadow">
<h2 class="text-xl font-semibold mb-2">Active Projects</h2>
<p class="text-4xl font-bold text-blue-600">24</p>
</semantic-card>
<semantic-card class="p-6 hover:shadow-xl transition-shadow">
<h2 class="text-xl font-semibold mb-2">Team Members</h2>
<p class="text-4xl font-bold text-green-600">12</p>
</semantic-card>
<semantic-card class="p-6 hover:shadow-xl transition-shadow">
<h2 class="text-xl font-semibold mb-2">Tasks Due</h2>
<p class="text-4xl font-bold text-orange-600">8</p>
</semantic-card>
</semantic-grid>
<!-- Form -->
<semantic-card class="p-8 max-w-2xl mx-auto">
<h2 class="text-2xl font-bold mb-6">Create New Task</h2>
<semantic-stack direction="vertical" spacing="4">
<semantic-input
label="Task Name"
class="w-full"
required>
</semantic-input>
<semantic-input
label="Description"
type="textarea"
class="w-full h-32">
</semantic-input>
<semantic-stack direction="horizontal" spacing="2" class="justify-end">
<semantic-action intent="secondary" class="px-4">
Cancel
</semantic-action>
<semantic-action intent="primary" sentiment="constructive" class="px-6">
Create Task
</semantic-action>
</semantic-stack>
</semantic-stack>
</semantic-card>
</semantic-container>
</body>
</html>
9. Advantages Over Pure Tailwind
- Semantic meaning preserved - Components still describe intent
- Complex interactions built-in - Don't rebuild modals, inputs, etc.
- Accessibility automatic - WCAG compliance by default
- Modality-agnostic - Voice, touch, keyboard work automatically
- Utility flexibility - Override and compose when needed
- Systematic optimization - Components pre-tested with grid methodology
- Future-proof - New platforms supported automatically
10. Advantages Over Pure Components
- Rapid prototyping - Utility classes for quick iterations
- Custom layouts - Full layout control with Tailwind
- Fine-tuned spacing - Precise control when needed
- Responsive design - Tailwind's responsive utilities
- Theme customization - Easy to override component defaults
- Gradual adoption - Use utilities where needed, components where beneficial
Conclusion: The Best of Both Worlds
Tailwind Plus = Semantic Components + Utility Classes
- Use components for complex interactive patterns
- Use utilities for layout, spacing, responsive design
- Get modality-agnostic behavior + rapid development
- Maintain semantic meaning + styling flexibility
This is the framework that combines modern utility-first CSS with future-proof semantic components.