About angular-elements
A development skill for turning Angular components into custom elements with @angular/elements. It covers input and output mapping, standalone elements, packaging, and use in micro-frontends.
Key features
- 01Create custom elements from Angular components
- 02Map component inputs and outputs
- 03Configure custom element behavior
- 04Build standalone elements
- 05Bundle elements for distribution
- 06Register elements for micro-frontends
Use cases
- 01Expose an Angular component as a web component
- 02Connect web component attributes and events to Angular
- 03Build reusable elements for micro-frontends
- 04Configure a single-bundle element build
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ oguzhan18/ angular-ecosystem-skills --skill angular-elementsAfter installing, type/angular-elementsin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/discussions/_INDEX.mdreferences/docs/_INDEX.mdreferences/issues/_INDEX.mdreferences/releases/_INDEX.mdDetails
From the project README@angular/elements
Version: Angular 21 (2025) Tags: Web Components, Custom Elements, Micro-frontends
References: Elements Guide • API
API Changes
This section documents recent version-specific API changes.
-
NEW: createCustomElement API — Package Angular components as custom elements
-
NEW: NgElementConfig — Configure custom element behavior
-
NEW: Input/Output mapping — Map Angular inputs/outputs to web component attributes
-
NEW: Standalone elements — Build standalone elements without NgModule
Best Practices
- Install @angular/elements
npm install @angular/elements
- Create custom element from component
import { createCustomElement } from '@angular/elements';
@Injectable()
export class ElementRegistrar {
constructor(private injector: Injector) {}
register() {
const element = createCustomElement(MyComponent, { injector: this.injector });
customElements.define('my-element', element);
}
}
- Use in main.ts
import { createApplication } from '@angular/platform-browser';
import { createCustomElement } from '@angular/elements';
bootstrapApplication(AppComponent).then(appRef => {
const element = createCustomElement(MyComponent, { injector: appRef.injector });
customElements.define('my-component', element);
});
- Map inputs and outputs
const element = createCustomElement(MyComponent, {
injector: this.injector,
events: ['myEvent'],
attributes: ['myInput']
});
- Use CUSTOM_ELEMENTS_SCHEMA
// To use custom elements in Angular
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@NgModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {}
- Build as web component
// angular.json
{
"build": {
"options": {
"outputPath": "dist",
"singleBundle": true
}
}
}
- Use input() and output() for web component data
@Component({
selector: 'my-element',
standalone: true
})
export class MyElementComponent {
data = input<string>('');
output = output<string>();
onClick() {
this.output.emit('event-data');
}
}
- Handle content projection
@Component({
selector: 'my-element',
template: `
<div class="header">
<ng-content select="[header]"></ng-content>
</div>
<div class="body">
<ng-content></ng-content>
</div>
`
})
export class MyElementComponent {}
- Use for micro-frontends
// Register multiple elements
const elements = [ButtonComponent, CardComponent, InputComponent];
elements.forEach(comp => {
const el = createCustomElement(comp, { injector });
customElements.define(comp.selector, el);
});