|
π Quick Start Β· β¨ Features Β· π¬ How It Works Β· βοΈ Configuration Β· π₯οΈ CLI Β· π API
β The Problem
|
β The Solution
|
# Install globally
npm install -g ghost-ui
# Capture a static element
ghost-ui capture https://stripe.com --selector ".navbar" --output Navbar.tsx
# Record an interaction
ghost-ui record https://apple.com --duration 5s --output HeroAnimation.tsx
Point and click to capture any element. Ghost-UI analyzes the visual appearance and generates semantic code.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β WHAT YOU SEE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββββββββββββββ β
β β ββββ Stripe β β
β β ββββββββββββββββββββββββββββ β β
β β Products βΌ Solutions βΌ ... β β
β βββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β WHAT YOU GET β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β export function Navbar() { β
β return ( β
β <nav className="flex items-center justify-between"> β
β <Logo /> β
β <NavLinks /> β
β <CTAButton /> β
β </nav> β
β ); β
β } β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Record hover states, click animations, scroll effects, and more:
// Captured from: apple.com hero section
export function HeroSection() {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.6, ease: "easeOut" }}
>
<h1 className="text-6xl font-semibold tracking-tight">
iPhone 15 Pro
</h1>
<motion.p
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ delay: 0.3 }}
>
Titanium. So strong. So light. So Pro.
</motion.p>
</motion.div>
);
}
| Framework | Status | Animation Library |
|---|---|---|
| React + Tailwind | β Full | Framer Motion |
| React + CSS Modules | β Full | CSS Animations |
| Vue 3 + Tailwind | β Full | Vue Transitions |
| Svelte | β Full | Svelte Transitions |
| Vanilla HTML/CSS | β Full | CSS Animations |
| React Native | π§ Beta | Reanimated |
Ghost-UI doesn't just screenshotβit understands motion:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ANIMATION DETECTION β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β β
CSS Transitions β Captures timing, easing, properties β
β β
CSS Animations β Extracts keyframes β
β β
JS Animations β Records WAAPI, GSAP patterns β
β β
Scroll Effects β Detects parallax, reveal animations β
β β
Hover States β Captures interaction feedback β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GHOST-UI β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββββββ β
β β Browser βββββΆβ Recorder βββββΆβ Screenshot β β
β β Extension β β (Playwright)β β + DOM Snap β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββ¬βββββββββ β
β β β
β βΌ β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββββββ β
β β Output ββββββ Code Gen ββββββ Vision Model β β
β β Component β β Engine β β (GPT-4o/etc) β β
β ββββββββββββββββ ββββββββββββββββ βββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Step | Action |
|---|---|
| 1. Capture | Browser extension or Playwright captures screenshot + computed styles + DOM structure |
| 2. Analyze | Vision-Language Model analyzes the visual design and interaction patterns |
| 3. Generate | Code generation engine outputs clean, semantic code in your chosen framework |
| 4. Refine | Optional iteration loop to adjust styling or behavior |
Create ghost-ui.config.ts in your project:
import { defineConfig } from 'ghost-ui';
export default defineConfig({
// Output settings
output: {
framework: 'react', // 'react' | 'vue' | 'svelte' | 'vanilla'
styling: 'tailwind', // 'tailwind' | 'css-modules' | 'styled-components'
animation: 'framer-motion', // 'framer-motion' | 'css' | 'gsap'
typescript: true,
},
// AI settings
ai: {
provider: 'openai', // 'openai' | 'anthropic' | 'local'
model: 'gpt-4o',
creativity: 0.3, // 0-1, lower = more faithful to original
},
// Component settings
component: {
extractColors: true, // Extract to CSS variables
useSemanticHTML: true, // Use proper HTML elements
addA11y: true, // Add ARIA attributes
responsive: true, // Generate responsive variants
},
// Recording settings
recorder: {
captureHover: true,
captureClick: true,
captureScroll: true,
maxDuration: 10000, // ms
},
});
# Capture a single element
ghost-ui capture <url> --selector <css-selector>
# Record an interaction
ghost-ui record <url> --duration <time>
# Interactive mode (opens browser)
ghost-ui interactive <url>
# Convert existing screenshot to component
ghost-ui from-image ./screenshot.png
# Batch process multiple elements
ghost-ui batch --config ./captures.json
# Capture Stripe's pricing table
ghost-ui capture https://stripe.com/pricing \
--selector ".pricing-table" \
--framework react \
--output PricingTable.tsx
# Record Apple's scroll animation
ghost-ui record https://apple.com/iphone \
--duration 5s \
--scroll \
--output ScrollReveal.tsx
# Capture with custom AI prompt
ghost-ui capture https://linear.app \
--selector ".issue-card" \
--prompt "Make it dark mode with purple accents"
import { GhostUI } from 'ghost-ui';
const ghost = new GhostUI({
ai: { provider: 'openai', model: 'gpt-4o' },
output: { framework: 'react', styling: 'tailwind' },
});
// Capture from URL
const component = await ghost.capture({
url: 'https://stripe.com',
selector: '.hero-section',
});
console.log(component.code);
// β React component code
console.log(component.styles);
// β Extracted styles
console.log(component.assets);
// β Referenced images/icons
Run completely offline with local models:
// ghost-ui.config.ts
export default defineConfig({
ai: {
provider: 'local',
endpoint: 'http://localhost:11434', // Ollama
model: 'llava:34b', // Vision model
},
});
| Provider | Link |
|---|---|
| Ollama with LLaVA | ollama.ai |
| LocalAI | localai.io |
| OpenAI-compatible | Any endpoint |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GHOST-UI ETHICS β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β β
Learn from great designs β
β β
Understand animation techniques β
β β
Speed up prototyping β
β β
Study accessibility patterns β
β β
β β Don't copy proprietary designs verbatim β
β β Don't violate copyright β
β β Don't pass off others' work as your own β
β β
β β οΈ Always credit inspiration and create original work β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Feature | Ghost-UI | Screenshot-to-Code | Figma-to-Code |
|---|---|---|---|
| Live website capture | β | β | β |
| Animation capture | β | β | β |
| Interaction recording | β | β | β |
| Multiple frameworks | β | React only | Varies |
| Local AI support | β | β | β |
| Browser extension | β | β | β |
| CLI tool | β | β | β |
We welcome contributions! See CONTRIBUTING.md for guidelines.
git clone https://github.com/your-org/ghost-ui.git
cd ghost-ui
pnpm install
pnpm dev
MIT License Β© Ghost-UI Contributors
π» Ghost-UI β Stop reverse-engineering. Start shipping.
"Good artists copy. Great artists ship before lunch."