JD json-to-dom Samples Library
💡 Practical Examples • Zero Build Step • Pure Native DOM

Interactive Samples & Recipes

Explore real, standalone HTML examples demonstrating how to convert declarative JSON specifications into live browser DOM elements.

✨ New Form Layouts Series

Form Label & Input Alignment Styles

Explore our dedicated collection focusing exclusively on label and single-input alignment: Label Above (stacked), Label Left (left-aligned), Label Left (right-aligned), and Joined Addon Box. Pure layout declarations with zero JS/events.

View Form Styles →
📝 5 Samples

Forms & Input Alignments

Concentrated label & input positioning: Label Above, Label Left (left-aligned), Label Left (right-aligned), Joined Addon Box, and complete interactive forms.

Folder: samples/forms/ →
🃏 Components

Cards & Content Containers

Fundamental components including badges, headings, action buttons, pricing tiers, and feature checklists with Tailwind styling.

Folder: samples/cards/ →
📊 Data Grid

Data Tables & Financial Grids

Semantic HTML table structures generated directly from data record arrays, with accounting vouchers, batches, and currencies.

Folder: samples/tables/ →
⚡ Events & State

Interactive Widgets & Dynamic CRUD

Binding event listeners (`click`, `input`), state mutation, runtime factory nodes, and contextual deletion handlers.

Folder: samples/interactive/ →
📈 Layouts

Complex Dashboard Layouts

Deep recursive tree nesting with multi-column grids, metrics KPI cards, activity feeds, and system status widgets.

Folder: samples/dashboards/ →

How to Use Samples in Your Own Project

Include the standalone bundle with a single script tag, then call window.ks["json-to-dom"].buildSpecElement anywhere:

<div id="app"></div>

<!-- Load standalone engine bundle -->
<script type="module" src="https://keshavsoft.github.io/json-to-dom/dist/min.js"></script>

<!-- Run declarative rendering -->
<script type="module">
    const spec = {
        tagName: "div",
        attributes: { class: "p-4 bg-blue-50 text-blue-800 rounded-lg shadow-sm" },
        textContent: "Hello from declarative JSON!"
    };

    // Access engine via window.ks["json-to-dom"]
    const node = window.ks["json-to-dom"].buildSpecElement({ inSpec: spec });
    document.getElementById("app").appendChild(node);
</script>