liftSolid<TAttributes extends Attributes,Options extends LiftOptions<TAttributes>,>(tagName: string,opts: Partial<LiftOptions<TAttributes>>,): LiftBaseConstructor<TAttributes, Options>
Creates a custom element. The init function is called when the element is
connected to the DOM, and you can safely use Solid's reactive primitives like
createEffect and onCleanup and createSignal inside it.
Example 1
Example 1
// rendered with <hello-el name="world"></hello-el> import { liftSolid, useAttributes } from "@lift-html/solid"; import { createEffect } from "solid-js"; liftSolid("hello-el", { observedAttributes: ["name"], init() { const props = useAttributes(this); createEffect(() => { this.innerText = "Hello, " + props.name; }); }, });
TAttributes extends Attributes
Options extends LiftOptions<TAttributes>
tagName: string
opts: Partial<LiftOptions<TAttributes>>