npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@thi.ng/rdom-forms

v1.1.2

Published

Data-driven declarative & extensible HTML form generation

Readme

@thi.ng/rdom-forms

npm version npm downloads Mastodon Follow

[!NOTE] This is one of 214 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.

🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️

About

Data-driven declarative & extensible HTML form generation. This is a support package for @thi.ng/rdom.

This package uses vanilla JS objects to define component specs for various types of form elements (various factory functions are provided). These specs can then be passed to the polymorphic & dynamically extensible compileForm() function to generate the actual form elements/components in hiccup format, which can then be used with thi.ng/rdom or for static (or SSR) HTML generation via thi.ng/hiccup.

All generated form elements are unstyled by default, but can be fully customized (in various stages) via user-provided options.

Examples

Please see the rdom-formgen example project, which demonstrates all supported elements and various customization options...

Login form

import {
    compileForm, form, hidden, password, str, submit
} from "@thi.ng/rdom-forms";

// compile form from given field descriptions
const loginForm = compileForm(
    form({ action: "/login", method: "post" },
        // string input
        str({ id: "user", label: "Username", desc: "or email address" }),
        // password
        password({ id: "pass", label: "Password", desc: "min. 8 characters", min: 8 }),
        // hidden form value
        hidden({ name: "target", value: "user-home" }),
        submit({ title: "Login", label: "" })
    ),
    {
        // disable reactive value subscriptions
        behaviors: { values: false },
        // customize attribs for label descriptions
        descAttribs: { class: "desc" }
    }
);

// use thi.ng/hiccup to serialize as HTML
import { serialize } from "@thi.ng/hiccup";

console.log(serialize(loginForm));

Resulting output (reformatted):

<form action="/login" method="post">
    <div>
        <label for="user">Username<span class="desc">or email address</span></label>
        <input type="text" id="user" name="user" />
    </div>
    <div>
        <label for="pass">Password<span class="desc">min. 8 characters</span></label>
        <input type="password" autocomplete minlength="8" id="pass" name="pass" />
    </div>
    <input type="hidden" id="target" name="target" value="user-home" />
    <div>
        <label for="submit-0"></label>
        <input type="submit" value="Login" id="submit-0" name="submit-0" />
    </div>
</form>

Status

ALPHA - bleeding edge / work-in-progress

Search or submit any issues for this package

Related packages

Installation

yarn add @thi.ng/rdom-forms

ESM import:

import * as rf from "@thi.ng/rdom-forms";

Browser ESM import:

<script type="module" src="https://esm.run/@thi.ng/rdom-forms"></script>

JSDelivr documentation

Package sizes (brotli'd, pre-treeshake): ESM: 2.34 KB

Dependencies

Note: @thi.ng/api is in most cases a type-only import (not used at runtime)

Usage examples

Nine projects in this repo's /examples directory are using this package:

| Screenshot | Description | Live demo | Source | |:-------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------|:--------------------------------------------------------|:-------------------------------------------------------------------------------------| | | Large ASCII font text generator using @thi.ng/rdom | Demo | Source | | | Interactive & reactive image blurhash generator | Demo | Source | | | Color palette generation via dominant color extraction from uploaded images | Demo | Source | | | Matrix-based image color adjustments | Demo | Source | | | Interactive pixel sorting tool using thi.ng/color & thi.ng/pixel | Demo | Source | | | Basic usage of the declarative rdom-forms generator | Demo | Source | | | rdom & hiccup-canvas interop test | Demo | Source | | | Interactive ridge-line plot | Demo | Source | | | Interactive scatter & line plot of low-discrepancy samples | Demo | Source |

API

Generated API docs

TODO

Authors

If this project contributes to an academic publication, please cite it as:

@misc{thing-rdom-forms,
  title = "@thi.ng/rdom-forms",
  author = "Karsten Schmidt",
  note = "https://thi.ng/rdom-forms",
  year = 2023
}

License

© 2023 - 2026 Karsten Schmidt // Apache License 2.0