Function: Behavior()

function Behavior<T>(target: T, context: ClassDecoratorContext): T;

Defined in: src/behaviors/decorators.ts:29

Type Parameters

Type Parameter
T extends (…args: any[]) => any

Parameters

Parameter Type
target T
context ClassDecoratorContext

Returns

T

Behavior

class decorator.

Marks a class as a Behavior and registers it in the BehaviorRegistry. The class should have at least one

Prop

decorated field that serves as the activator (a boolean prop that enables the behavior).

Example

Behavior

export class Link {

Host

el!: HTMLAnchorElement;

Prop

link: boolean = true; // Activator

Prop

href: string = ‘’; // Config

Prop

activeClass?: string; // Optional config

onInit() { this.el.href = this.href; } }

// Usage in JSX: <a link href="/home" activeClass=“active”>Home</a>