
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
@remote-ui/htm
Advanced tools
This library provides a binding that converts [`htm`](https://github.com/developit/htm) templates into operations on a [`@remote-ui/core` `ReactRoot`](../core#remoteroot).
@remote-ui/htm
This library provides a binding that converts htm
templates into operations on a @remote-ui/core
ReactRoot
.
Using yarn
:
yarn add @remote-ui/htm
or, using npm
:
npm install @remote-ui/htm --save
@remote-ui/htm
provides two functions. The first, createHtm
, is a factory function that takes a @remote-ui/core
RemoteRoot
, and returns a tagged template. This tagged template binds the main function from the htm
library into creating a tree of @remote-ui/core
RemoteComponent
and RemoteText
objects. The second function, append
, is a helper to call appendChild()
on a RemoteRoot
or RemoteComponent
for each node in the tree returned by the tagged template.
import {createRemoteRoot} from '@remote-ui/core';
import {createHtm, append} from '@remote-ui/htm';
const root = createRemoteRoot(() => {});
const htm = createHtm(root);
const onPress = () => {};
append(htm`<Button primary onPress=${onPress}>Submit</Button>`, root);
This library only helps you create the initial structure of remote components. Any subsequent updates to that structure (for example, responding to a button press by changing its content) would be performed with the RemoteRoot
and RemoteComponent
APIs.
htm
supports many handy syntax features. Notably, if you have external definitions of the remote components available in your system, you can interpolate them as the type name within your markup.
import {createRemoteRoot} from '@remote-ui/core';
import {createHtm, append} from '@remote-ui/htm';
import {BlockStack, Button, Text} from 'my-remote-components';
const root = createRemoteRoot(() => {});
const htm = createHtm(root);
const stack = root.createComponent(BlockStack);
append(
htm`
<${Button} onPress=${() => console.log('Pressed!')}>Submit<//>
<${Text} subdued>You’ll have a chance to review your purchase<//>
`,
stack,
);
FAQs
This library provides a binding that converts [`htm`](https://github.com/developit/htm) templates into operations on a [`@remote-ui/core` `ReactRoot`](../core#remoteroot).
The npm package @remote-ui/htm receives a total of 5 weekly downloads. As such, @remote-ui/htm popularity was classified as not popular.
We found that @remote-ui/htm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.