UNPKG

@zeix/ui-element

Version:

UIElement - minimal reactive framework based on Web Components

35 lines (31 loc) 486 B
import { type Component, component, first, on, RESET, setText, } from "../../../"; export type HelloWorldProps = { name: string; }; export default component( "hello-world", { name: RESET, }, (el) => [ first("span", setText("name")), first( "input", on("input", (e: Event) => { el.name = (e.target as HTMLInputElement)?.value || RESET; }), ), ], ); declare global { interface HTMLElementTagNameMap { "hello-world": Component<HelloWorldProps>; } }