FunctionsComponentComponent CallableComponent(tagName: string): ComponentConstructor<{}>Component<M>(tagName: string, metadata: M, opts?: ComponentOptions): ComponentConstructor<M>Creates a new web component class. Specify props and events using the metadata parameter.@exampleclass MyComponent extends Component("my-component", { myProp: prop<string>("Hello, world!"), onMyEvent: event(),}) { render() { return ( <> <h1>{this.props.myProp}</h1> <button onclick={() => this.events.onMyEvent()}>Click me</button> </> ); },}customElements.define("my-component", MyComponent);
Creates a new web component class.
Specify props and events using the
metadata
parameter.