zunokit-builder
v0.2.0
Published
π¨ Figma-style drag-and-drop UI builder for React developers. Create UI visually, export clean Tailwind CSS code. Perfect for rapid prototyping and component creation.
Maintainers
Readme
zunokit-builder
π¨ A React library for developers that enables Figma-style drag-and-drop UI creation with clean, production-ready code generation.
Built for developers who want to create UI quickly through visual editing, then export hand-written quality code that can be edited and deployed normally.
β¨ Features
- π¨ Figma-style visual editor - Intuitive drag & drop interface for developers
- β‘ Real-time code generation - Automatically generates clean JSX components as you build
- π§Ή Clean, maintainable output - Produces hand-written quality code with proper component structure
- π― Development-only - Builder interface only appears in
NODE_ENV=development - π¨ Tailwind-first - Generated code uses Tailwind CSS classes exclusively (no inline styles)
- π¦ Smart component modularization - Automatically splits complex UI into reusable components
- π§ Auto-imports - Manages component imports automatically
- π Layout persistence - Saves layouts to
.zuno/layout.jsonfor versioning and undo - ποΈ Property editing - Visual property panel for editing component props
- π± Responsive design - Support for different viewport sizes and breakpoints
π¦ Installation
npm install zunokit-builder
# or
yarn add zunokit-builder
# or
pnpm add zunokit-builderPeer Dependencies:
- React >=16.8.0
- React DOM >=16.8.0
π Quick Start
1. Wrap your app with ZunoBuilder
import { ZunoBuilder } from 'zunokit-builder'
function App() {
return (
<ZunoBuilder>
<div className="min-h-screen bg-gray-50">
{/* Your existing app content */}
<h1>My App</h1>
</div>
</ZunoBuilder>
)
}
export default App2. Start development
npm run dev3. Open the builder
In development mode, you'll see an "Open Builder" button in the top-right corner. Click it to open the visual editor.
4. Build your UI
- π Drag components from the sidebar (Text, Button, Input, etc.)
- π― Click elements to select and edit their properties
- π Resize and position elements visually
- πΎ Changes are automatically saved to
.zuno/layout.json
ποΈ Configuration
import { ZunoBuilder } from 'zunokit-builder'
function App() {
return (
<ZunoBuilder
config={{
enabled: true, // Force enable (default: NODE_ENV === 'development')
targetPath: './src/components/GeneratedUI.tsx',
layoutPath: './.zuno/layout.json',
theme: {
primaryColor: '#3b82f6',
borderRadius: '0.5rem'
},
ui: {
position: 'top-right',
showGrid: true,
gridSize: 10
},
codegen: {
componentNaming: 'PascalCase',
generateTypes: true,
includeComments: true
}
}}
>
<YourApp />
</ZunoBuilder>
)
}π§© Available Blocks
| Block | Description | Properties | |-------|-------------|------------| | Text | Typography elements | content, tag (h1-h6, p, span), fontSize, fontWeight, textAlign | | Button | Interactive buttons | text, variant (default, destructive, outline, etc.), size, href | | Input | Form inputs | type, placeholder, label, validation, size, variant | | Image | Responsive images | src, alt, objectFit, loading, quality, rounded | | Section | Layout containers | padding, margin, background, flexDirection, gap | | Card | Card containers | background, border, borderRadius, shadow |
π§ Advanced Usage
Custom Configuration
interface ZunoBuilderConfig {
enabled?: boolean
targetPath?: string
layoutPath?: string
theme?: {
primaryColor?: string
borderRadius?: string
fontFamily?: string
}
ui?: {
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
showGrid?: boolean
gridSize?: number
darkMode?: boolean
}
codegen?: {
componentNaming?: 'PascalCase' | 'camelCase' | 'kebab-case'
fileOrganization?: 'single-file' | 'component-per-file' | 'grouped-by-type'
generateTypes?: boolean
includeComments?: boolean
}
}Using with Next.js
// pages/_app.js or app/layout.js
import { ZunoBuilder } from 'zunokit-builder'
function MyApp({ Component, pageProps }) {
return (
<ZunoBuilder>
<Component {...pageProps} />
</ZunoBuilder>
)
}
export default MyAppTypeScript Support
Full TypeScript support with comprehensive type definitions:
import { ZunoBuilder, ZunoBuilderConfig, ZunoBlock } from 'zunokit-builder'
const config: ZunoBuilderConfig = {
enabled: process.env.NODE_ENV === 'development',
targetPath: './src/components/Generated.tsx'
}ποΈ How It Works
- Development Mode: Builder appears only when
NODE_ENV=development - Visual Editing: Drag, drop, and configure UI elements visually
- Real-time Generation: Every change generates clean JSX code
- Clean Output: Generated code looks like hand-written components
- Production Ready: Builder disappears in production builds
π€ Contributing
We welcome contributions! Please see our Contributing Guide for details.
π License
MIT License - see LICENSE file for details.
π Links
Made with β€οΈ by the Zuno Team
