Web Components
The basics of the web-component plugin for Aurelia.
Introduction
Installing The Plugin
npm install @aurelia/web-componentsBasic Setup
import { Aurelia, AppTask } from 'aurelia';
import { IWcElementRegistry } from '@aurelia/web-components';
Aurelia
.register(
AppTask.creating(IWcElementRegistry, registry => {
// Define your web components here
registry.define('my-element', class MyElement {
static template = '<p>Hello from Web Component!</p>';
});
})
)
.app(class App {})
.start();API Reference
Parameters
How it works
Important Notes
Examples
1. Basic Web Component
2. Web Component with Bindable Properties
3. Web Component with Shadow DOM
4. Web Component with Lifecycle and Host Injection
5. Web Component with Object Definition
6. Extending Built-in Elements
7. Web Component with Advanced Features
Error Handling and Validation
Invalid Element Names
Containerless Components
Usage Outside Aurelia Applications
Vanilla JavaScript
React Integration
Angular Integration
Best Practices
Last updated
Was this helpful?