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

foldui

v0.0.2

Published

Schema-driven engine for building web UI

Readme

foldui

A lightweight, component rendering engine built on top of the DOM.

foldui lets you define strongly-typed components with schema-driven props, default values, scoped styling, and a powerful render helper — without a virtual DOM.

Installation

Using npm

npm install foldui
import { Fold } from 'foldui'

Using CDN

<script src="https://unpkg.com/foldui/dist/foldui.umd.js"></script>

🚀 Basic Usage

<div id="container"></div>

Create a component

 Fold.addComponent({
    name: 'main',
    render: ({ props, helper }) => {
        const sectionEl = helper.el('section', 'main')
        return sectionEl
    }
})

Fold.addComponent({
    name: 'heading',
    props: {
        title: { type: 'string', default: 'Heading' },
    },
    defaultStyle: {
        heading: {
            fontSize: '24px',
            color: '#333',
        }
    },
    render: ({ props, helper }) => {
        const headingEl = helper.el('h1', 'heading')
        headingEl.innerText = props.title
        return headingEl
    }
})

Register & Render

 const schema = {
    id: 'main-1',
    type: 'main',
    style: {
        main: {
            background: 'red',
        }
    },
    children: [
        {
            id: 'heading-1',
            type: 'heading',
            props: {
                title: 'Foldui is amazing',
            },
            style: {
                fontSize: '30px',
            },
        }
    ]
}

const html = Fold.render(schema)

const containerEl = document.getElementById('container')
containerEl.appendChild(html)

⚙️ API Reference

Fold.createComponent(options)

{
    type: string
    props?: {
        [key: string]: {
            type: 'string' | 'number' | 'boolean' | 'object' | 'array',
            default?: any
        }
    },
    defaultStyle?: {
        [partName: string]: {
            [cssProperty: string]: string
        }
    },
    render(context): HTMLElement
}

render(context)

The render function receives:

{
  id: string,      // unique node id
  props: object,   // resolved props (with defaults applied)
  ui: object       // rendering utilities
}

ui (Render Utilities)

ui.el(tag, part?)

Example

render({ props, ui }) {
  const img = ui.el('img')
  img.src = props.src
  img.alt = props.alt
  return img
}

ui.el('img') creates a dom.

You can also give the dom a 'part' name

const img = helper.el('img', 'image')

This generates:

<button data-part="image" data-fui-owner="componentId"></button>

Ideal Use Cases

  • Visual page builders
  • Quiz generator
  • Form creator

License

MIT