Generate Command
The generate command is the primary command in IntentCSS. It converts natural language prompts into Tailwind CSS classes or plain CSS.
Overview
The generate command accepts a prompt, processes it through the Intent Engine, and produces styling output.
Basic syntax:
intentcss generate --prompt "<prompt>"
intentcss generate --prompt "<prompt>"
Example:
intentcss generate --prompt "blue button"
intentcss generate --prompt "blue button"
Output:
rounded-lg bg-blue-600 px-4 py-2 text-white hover:bg-blue-700
rounded-lg bg-blue-600 px-4 py-2 text-white hover:bg-blue-700
Command Syntax
intentcss generate --prompt "<prompt>" [options]
intentcss generate --prompt "<prompt>" [options]
Required Options
| Option | Description |
|---|---|
--prompt | The prompt to generate from |
Example:
intentcss generate --prompt "red button"
intentcss generate --prompt "red button"
Output Targets
IntentCSS supports multiple output targets.
Tailwind (Default)
intentcss generate --prompt "glass login form"
intentcss generate --prompt "glass login form"
Output:
flex flex-col gap-4 backdrop-blur-md bg-white/30 border border-white/20 rounded-xl shadow-md p-6 space-y-2
flex flex-col gap-4 backdrop-blur-md bg-white/30 border border-white/20 rounded-xl shadow-md p-6 space-y-2
CSS
intentcss generate --prompt "glass login form" --target css
intentcss generate --prompt "glass login form" --target css
Output:
.form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.form {
display: flex;
flex-direction: column;
gap: 1rem;
}
Examples
Button
intentcss generate --prompt "large red button"
intentcss generate --prompt "large red button"
Output:
rounded-lg bg-red-600 px-6 py-3 text-lg text-white hover:bg-red-700
rounded-lg bg-red-600 px-6 py-3 text-lg text-white hover:bg-red-700
Card
intentcss generate --prompt "glass shadow card"
intentcss generate --prompt "glass shadow card"
Output:
backdrop-blur-md bg-white/30 border border-white/20 rounded-xl shadow-lg p-6
backdrop-blur-md bg-white/30 border border-white/20 rounded-xl shadow-lg p-6
Form
intentcss generate --prompt "responsive centered login form"
intentcss generate --prompt "responsive centered login form"
Output:
mx-auto flex flex-col gap-4 rounded-xl bg-white p-6 shadow-md w-full max-w-md space-y-2
mx-auto flex flex-col gap-4 rounded-xl bg-white p-6 shadow-md w-full max-w-md space-y-2
Navbar
intentcss generate --prompt "dark navbar"
intentcss generate --prompt "dark navbar"
Output:
flex items-center justify-between p-4 bg-gray-900 text-white border-b border-gray-800
flex items-center justify-between p-4 bg-gray-900 text-white border-b border-gray-800
Modal
intentcss generate --prompt "glass centered modal"
intentcss generate --prompt "glass centered modal"
Output:
fixed inset-0 flex items-center justify-center w-full max-w-lg p-6 backdrop-blur-md bg-white/30 border border-white/20 rounded-xl shadow-lg
fixed inset-0 flex items-center justify-center w-full max-w-lg p-6 backdrop-blur-md bg-white/30 border border-white/20 rounded-xl shadow-lg
Sidebar
intentcss generate --prompt "dark compact sidebar"
intentcss generate --prompt "dark compact sidebar"
Output:
w-48 min-h-screen bg-gray-900 text-white
w-48 min-h-screen bg-gray-900 text-white
Hero
intentcss generate --prompt "glass rounded shadow hero"
intentcss generate --prompt "glass rounded shadow hero"
Output:
text-center py-20 px-8 backdrop-blur-md bg-white/30 border border-white/20 shadow-xl rounded-3xl
text-center py-20 px-8 backdrop-blur-md bg-white/30 border border-white/20 shadow-xl rounded-3xl
Footer
intentcss generate --prompt "large blue footer"
intentcss generate --prompt "large blue footer"
Output:
p-10 bg-blue-600 text-white shadow-lg
p-10 bg-blue-600 text-white shadow-lg
Typo Correction
The generate command automatically corrects common spelling mistakes.
Input:
intentcss generate --prompt "purpl buton"
intentcss generate --prompt "purpl buton"
IntentCSS detects:
Corrected: purple button
Corrected: purple button
Output:
rounded-lg bg-purple-600 px-4 py-2 text-white hover:bg-purple-700
rounded-lg bg-purple-600 px-4 py-2 text-white hover:bg-purple-700
Confidence Checking
Before generation occurs, IntentCSS evaluates confidence.
High Confidence
intentcss generate --prompt "green button"
intentcss generate --prompt "green button"
Output:
rounded-lg bg-green-600 px-4 py-2 text-white hover:bg-green-700
rounded-lg bg-green-600 px-4 py-2 text-white hover:bg-green-700
Medium Confidence
intentcss generate --prompt "login thing"
intentcss generate --prompt "login thing"
Output:
Detected intent: form
Confidence: Medium
Detected intent: form
Confidence: Medium
Low Confidence
intentcss generate --prompt "glorp wazzoo"
intentcss generate --prompt "glorp wazzoo"
Output:
Could not confidently understand that prompt.
Try words like: button, card, navbar, blue, responsive.
Could not confidently understand that prompt.
Try words like: button, card, navbar, blue, responsive.
Prompt Tips
The best prompts usually contain:
Component
button
card
form
navbar
modal
sidebar
hero
footer
button
card
form
navbar
modal
sidebar
hero
footer
Modifiers
large
glass
shadow
rounded
responsive
centered
dark
large
glass
shadow
rounded
responsive
centered
dark
Colors
blue
red
green
purple
black
blue
red
green
purple
black
Example:
intentcss generate --prompt "large red shadow button"
intentcss generate --prompt "large red shadow button"
Generation Pipeline
Internally, the generate command follows this process:
Prompt
↓
Typo Correction
↓
Prompt Parsing
↓
Intent Matching
↓
Confidence Scoring
↓
Output Generation
Prompt
↓
Typo Correction
↓
Prompt Parsing
↓
Intent Matching
↓
Confidence Scoring
↓
Output Generation
The final output is then printed to the terminal.
Related Commands
Explain
Explain generated classes:
intentcss explain "flex items-center justify-between"
intentcss explain "flex items-center justify-between"
Help
View command help:
intentcss generate --help
intentcss generate --help
Next Steps
Continue with:
- Explain Command
- Architecture
- Testing
- Contributing