import { html } from'@arrow-js/core'; import { arrowTags } from'arrow-tags'; constgreeting = 'Hello'; conststyle = 'color: red;'; // Render a span with red text to the DOM constel = document.getElementById('root'); arrowTags(html).span`${greeting}`({ style })(el);
Example
Pass reactive contents that update interactively
import { reactive, html } from'@arrow-js/core'; import { arrowTags } from'arrow-tags'; constdata = reactive({ i:0 }); constgreetings = ['Hello', 'Goodbye']; consttoGreeting = ({ i }) =>greetings[i % 2]; constprops = { data, "@click": () =>data.i += 1 }; // The button greeting reacts to user input constel = document.getElementById('root'); arrowTags(html).button`${toGreeting}`(props)(el);
Example
Pass attributes that update interactively
import { reactive, html } from'@arrow-js/core'; import { arrowTags } from'arrow-tags'; constdata = reactive({ i:0 }); constcolors = ['red', 'pink']; consttoColors = ({ i }) =>colors[i % 2]; conststyle = d=>`color: ${toColors(d)};`; // The button color reacts to user input constel = document.getElementById('root'); arrowTags(html).button`Hello`({ data, style, "@click": () =>data.i += 1 })(el);
Format tagged templates for HTML tags
Example
Pass contents, attributes, then html element
Example
Pass reactive contents that update interactively
Example
Pass attributes that update interactively