Skip to content

๐Ÿš€ Quick Start Guide โ€‹

Create your first widget with XCON Studio Widget Framework in 5 minutes!

๐Ÿ“‹ Requirements โ€‹

  • Node.js 18+
  • NPM 9+
  • Basic TypeScript knowledge

๐ŸŽฏ 1. Create Widget โ€‹

bash
# Create widget
npx @xcons/cli web create -n my-awesome

# Enter directory
cd my-awesome

# Install dependencies
npm install

# Start development
npm run dev

Go to http://localhost:4201 in your browser.

๐Ÿ“ 2. Widget Code โ€‹

Separate Template File โ€‹

typescript
@Widget({
    selector: '.my-widget',
    templateUrl: './widget.html',
    styleUrls: ['./widget.css']
})
export class MyWidget {
    @xproperty() name: string = 'World';
}

๐Ÿš€ 3. Build and Usage โ€‹

bash
# Build
npm run build

# Preview
npm run preview

Usage in HTML โ€‹

html
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="widget.css">
</head>
<body>
<div class="my-first-widget"></div>

<script src="https://unpkg.com/@xcons/core@latest/dist/core.js"></script>
<script src="https://unpkg.com/@xcons/common@latest/dist/common.js"></script>
<script src="widget.js"></script>

<script>
    XConBootstrap.run({
        widgets: [{ widget: MyFirstWidget, initMode: 'auto' }]
    });
</script>
</body>
</html>

๐ŸŽฏ Basic Features โ€‹

Decorators โ€‹

  • @xproperty() - Reactive property
  • @xcomputed() - Computed value
  • @xinject() - Service injection
  • @xsingleton() - Singleton service

Template Directives โ€‹

  • x:text="value" - Text display
  • x:model="property" - Two-way data binding
  • x:on:click="method" - Event binding
  • x:if="condition" - Conditional display
  • x:for="item in items" - List rendering
  • x:class:active="isActive" - Class binding

๐Ÿ› ๏ธ NPM Commands โ€‹

bash
npm run dev      # Development server
npm run build    # Production build
npm run preview  # Build preview
npm run clean    # Clean

๐Ÿ“š Next Steps โ€‹