@slotted Decorator
Overview
Basic Usage
import { slotted } from '@aurelia/runtime-html';
export class TabContainer {
// Watch all elements in the default slot
@slotted() tabs: Element[];
tabsChanged(newTabs: Element[], oldTabs: Element[]) {
console.log('Tabs changed:', newTabs);
}
}Filtering with CSS Selectors
Targeting Specific Slots
Watching All Slots
Change Callbacks
Custom Callback Names
Advanced Configuration
Configuration Options
Property
Type
Default
Description
Querying All Nodes Including Text Nodes
Complex Selectors
Complete Example: Dynamic Tab Component
Subscribing to Changes Programmatically
Lifecycle and Timing
Comparison with @children Decorator
Feature
@slotted
@children
Important Notes
See Also
Last updated
Was this helpful?