|
| 1 | +# Designer Modes Example |
| 2 | + |
| 3 | +This example demonstrates the three specialized designer modes in Object UI: |
| 4 | + |
| 5 | +## 🎯 Designer Modes |
| 6 | + |
| 7 | +### 1. Form Designer |
| 8 | +Optimized for building forms with validation and field management. |
| 9 | +- **Components**: Form fields, buttons, basic layout |
| 10 | +- **Branding**: Emerald/Teal |
| 11 | +- **Use Case**: Creating contact forms, registration forms, data entry forms |
| 12 | + |
| 13 | +### 2. Layout Designer |
| 14 | +Optimized for designing page layouts and structures. |
| 15 | +- **Components**: Containers, grids, navigation, content |
| 16 | +- **Branding**: Blue/Indigo |
| 17 | +- **Use Case**: Creating page structures, dashboards, landing pages |
| 18 | + |
| 19 | +### 3. General Designer |
| 20 | +Full-featured designer with all available components. |
| 21 | +- **Components**: All 30+ components |
| 22 | +- **Branding**: Purple/Pink |
| 23 | +- **Use Case**: Any UI design task requiring maximum flexibility |
| 24 | + |
| 25 | +## 🚀 Running the Example |
| 26 | + |
| 27 | +```bash |
| 28 | +# Install dependencies (from root) |
| 29 | +pnpm install |
| 30 | + |
| 31 | +# Run the example |
| 32 | +cd examples/designer-modes |
| 33 | +pnpm dev |
| 34 | +``` |
| 35 | + |
| 36 | +The application will start at `http://localhost:5173` |
| 37 | + |
| 38 | +## 🎨 Features |
| 39 | + |
| 40 | +- **Mode Switching**: Toggle between the three designer modes using the top navigation |
| 41 | +- **Live Preview**: See your changes in real-time as you design |
| 42 | +- **Schema Export**: Check the console to see the generated schema JSON |
| 43 | +- **Persistence**: Switch modes while maintaining your design (uses the same schema) |
| 44 | + |
| 45 | +## 📝 Usage |
| 46 | + |
| 47 | +1. **Start with a Mode**: Choose Form Designer for forms, Layout Designer for page structures, or General Designer for everything |
| 48 | +2. **Drag Components**: Drag components from the left panel to the canvas |
| 49 | +3. **Configure Properties**: Select a component and edit its properties in the right panel |
| 50 | +4. **Switch Modes**: Try switching between modes to see different component sets |
| 51 | +5. **Export Schema**: The schema is logged to the console on every change |
| 52 | + |
| 53 | +## 🔄 How It Works |
| 54 | + |
| 55 | +```tsx |
| 56 | +import { Designer } from '@object-ui/designer'; |
| 57 | + |
| 58 | +function App() { |
| 59 | + const [mode, setMode] = useState('general'); |
| 60 | + |
| 61 | + return ( |
| 62 | + <Designer |
| 63 | + mode={mode} |
| 64 | + onSchemaChange={(schema) => console.log(schema)} |
| 65 | + /> |
| 66 | + ); |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +## 📚 Related Documentation |
| 71 | + |
| 72 | +- [Specialized Designers Guide](../../packages/designer/SPECIALIZED_DESIGNERS.md) |
| 73 | +- [Main Designer Documentation](../../packages/designer/README.md) |
0 commit comments