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

@adminforth/json-form

v1.5.2

Published

JSON Schema driven form editor plugin for AdminForth

Readme

AdminForth JSON Form Plugin

Render a rich, schema-driven form for a JSON column instead of a raw text area. You describe the shape of the data with a JSON Schema (extended with a few x-* keywords for layout & validation messages) and the form is generated by jedison, a JSON-Schema form generator, mounted inside the AdminForth create/edit/show views.

JSON Form

Installation

npm i @adminforth/json-form

Usage

The plugin works only with json columns. If the target column is not of type json, the plugin throws during config validation.

import JsonFormPlugin from '@adminforth/json-form';
import { AdminForthDataTypes } from 'adminforth';

export default {
  // ...
  columns: [
    // ...
    {
      name: 'config',
      type: AdminForthDataTypes.JSON,   // required: must be JSON
      label: 'Config',
    },
  ],
  plugins: [
    new JsonFormPlugin({
      fieldName: 'config',
      schema: {
        title: 'RPG Character Creator',
        description: 'Create and customize your adventurer',
        type: 'object',
        'x-format': 'nav-vertical',
        properties: {
          identity: {
            title: 'Identity',
            type: 'object',
            'x-format': 'grid',
            required: ['name'],
            properties: {
              name: {
                title: 'Name',
                type: 'string',
                minLength: 2,
                'x-grid': { columns: 6 },
                'x-messages': { required: 'Every adventurer needs a name!' },
                default: 'Thalion Oakenshield',
              },
              // ...
            },
          },
          // ...
        },
      },
    }),
  ],
} as AdminForthResourceInput;

Options

| Option | Type | Description | |-------------|------------------|--------------------------------------------------------------------| | fieldName | string | Name of the JSON column the form edits. Required. | | schema | JsonFormSchema | JSON-Schema-like description of the form. Required. |

Supported schema

Standard JSON-Schema keywords: type (object / array / string / integer / number / boolean), properties, required, items, enum, const, oneOf, default, minLength, maxLength, minimum, maximum, minItems, maxItems, uniqueItems, readOnly, title, description.

Rendering keywords (x-format)

| Container | x-format | Result | |-----------|-----------------------|-------------------------------------------------------------| | object | nav-vertical | Each property becomes a section in a vertical tab bar | | object | grid | Properties laid out on a 12-column grid (see x-grid) | | object | key-value | Editable key / value rows (see below); the default for free-form objects | | object | (none) | Properties stacked vertically | | array | nav-horizontal | One tab per item; add / remove / reorder | | array | table / table-object | Editable table of rows | | array | checkboxes-inline | Inline checkbox group (arrays of enum values) | | array | (enum, none) | Multi-select dropdown | | scalar | textarea | Multi-line text | | scalar | color | Color picker + hex input | | scalar | range | Slider with live value | | scalar | radios / radios-inline | Radio group (for enum or boolean) | | scalar | checkbox | Single checkbox (for boolean) | | scalar | (none) | Text / number input, enum → dropdown, boolean → dropdown |

Free-form objects (key / value maps)

An object that declares no properties / patternProperties and allows additional ones is edited as a list of rows instead of jedison's popup based property editor:

{
  name: 'specifications',
  schema: {
    title: 'Specifications',
    type: 'object',
    additionalProperties: { type: 'string' },
  },
}
┌──────────────┬────────────────────────────┬───┐
│ engine       │ V8                         │ 🗑 │
│ color        │ red                        │ 🗑 │
└──────────────┴────────────────────────────┴───┘
  + Add property
  • Add property appends a row right away — no popup. The new key is an empty string and gets the focus, so you can type it immediately. Since an object can hold only one "" property, clicking Add again while an unnamed row is still there just focuses that row.
  • The key is edited inline and is applied when the input loses focus (or on Enter). The entry keeps its position and its value. Renaming to a key that already exists is refused with an inline message and the input rolls back.
  • The trash button removes the entry directly, without a confirmation popup.
  • The value cell holds the regular editor for additionalProperties, so any value type (including nested objects/arrays), its x-format and its validation messages keep working.

x-format: 'key-value' is accepted as an explicit marker but is not needed — free-form objects use this editor by default. Objects with declared properties, with patternProperties, with additionalProperties: false, or with another x-format (grid, nav-vertical, …) are rendered by jedison as before.

Other x-* keywords

| Keyword | Applies to | Description | |--------------------|-------------------|-----------------------------------------------------------------------| | x-grid | object properties | { columns: 1..12 } placement inside a grid object | | x-enumTitles | enum / boolean | Human-readable labels for each enum value (same order) | | x-messages | any | Per-rule custom validation messages, e.g. { minLength, required } | | x-titleIconClass | fields | Icon class rendered near the field title (e.g. bi bi-person-fill) | | x-keyPlaceholder | free-form objects | Placeholder of the key input in key / value rows (default Key) | | x-addPropertyContent | objects | Label of the "Add property" button | | x-sortable | arrays | Enables reordering controls | | x-titleTemplate | array items | Tab title template, e.g. {{ i1 }}) {{ value.name }} | | x-discriminator | oneOf objects | Property name used to distinguish oneOf branches | | x-switcherTitle | oneOf branch | Label of the branch in the variant switcher | | x-enforceConst | const markers | Keeps a discriminator's const value locked (hidden from the UI) |

Validation

Validation is performed live by jedison as the user edits. Failing rules block the form from being submitted and show an inline message next to the affected field. Messages can be customized per rule via x-messages; jedison's defaults are used otherwise.

Rendering & theming

The form is generated by jedison and mounted into the field's create/edit/show slot. The plugin ships a custom jedison theme (adminforthJedisonTheme.ts) plus CSS that styles the form with AdminForth's own design tokens — primary color, input borders/radius, labels and light/dark themes — so it blends into the admin panel. Object properties declared with x-format: nav-vertical render as a left-hand tab column (one tab per property), and nav-horizontal arrays render as a top tab bar; the theme also implements proper active-tab/pane switching (the stock jedison default theme relies on :target, which is unusable inside a SPA).

Free-form objects are rendered by a custom jedison editor (keyValueObjectEditor.ts, registered through jedison's customEditors option) that replaces the add-property / properties popups with inline key / value rows.

jedison is declared as a dependency of the plugin's frontend components (custom/package.json) and is installed automatically into the AdminForth SPA bundle.

License

MIT