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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@axdspub/axiom-ui-forms

v0.3.23

Published

Axiom UI Forms

Readme

React library that allows:

  • Creation of forms using a json config file
  • Creation of forms using a json schema draft 7, with selective overrides using json config
  • To do:
    • allow addition of new form types and UI components by consuming library
    • allow schema version 4 and draft 6
    • support schema required
    • support version 7 if/then/else
    • support version 7 readOnly
    • support version 7 writeOnly

.

Examples

Create a form using a config

Test form config here. Note: currently, forms with wizards or pages require that the parent route includes * (only tested with react-router-dom@7). Todo: make url navigation on form optional.

{
    "id": "example",
    "label": "Example form",
    "description": "This is just an example",
    "fields": [
        {
            "id": "title",
            "type": "text",
            "label": "Title"
        },
        {
            "id": "description",
            "type": "long_text",
            "label": "Description"
        },
         {
            "id": "favorites",
            "type": "text",
            "label": "List your favorite things",
           "multiple": true
        },
        {
            "id": "agree",
            "type": "boolean",
            "label": "Do you agree?"
        },
        {
            "id": "signature",
            "type": "text",
            "label": "Sign your name then",
            "conditions": { "dependsOn": "agree" }
        }
    ]
}
import React, {type ReactElement} from 'react'
import { FormCreator, type IForm, type IFormValues } from '@axdspub/axiom-ui-forms'

export default ExampleForm = ({formConfig}: {formConfig: IForm}): ReactElement => {
    const formValueState = React.useState<IFormValues>({})
    const [formValues] = formValueState
    useEffect(()=>{
        // respond to change in formValues
    },[formValues])

    return (
        <FormCreator form={formConfig} formValueState={formValueState} />
    )
}

Config to create a form with wizard steps using config.

Example here.

{
    "id": "example",
    "label": "Example form",
    "description": "This is just an example",
    "wizard_steps":[
      {
        "id":"intro",
        "label":"Introduction",
        "order": 0,
        "fields":[
            {
              "id": "title",
              "type": "text",
              "label": "Title"
          },
          {
              "id": "description",
              "type": "long_text",
              "label": "Description"
          }
        ]

      },
      {
        "id": "map",
        "label": "Step 2",
        "order": 1,
        "fields": [
          {
            "id": "map",
            "type": "geojson",
            "label": "Location"
          }
        ]
      },
      {
        "id": "about",
        "label": "About yourself",
        "order": 2,
        "pages":[
          {
            "id": "favorites",
            "label": "Favorites",
            "fields": [
                {
                  "id": "favorites_list",
                  "type": "text",
                  "label": "List your favorite things",
                  "multiple": true
                }
            ]
          },
          {
            "id":"sign",
            "label": "Signature",
            "fields": [
              {
                  "id": "agree",
                  "type": "boolean",
                  "label": "Do you agree?"
              },
              {
                  "id": "signature",
                  "type": "text",
                  "label": "Sign your name then"
              }
            ]
          }
        ]

      }

    ]
}

Create a form using a schema

Test schema to form here

{
  "$id": "/test/schema",
  "type": "object",
  "properties": {
    "label": {
      "type": "string",
      "maxLength": 100
    },
    "description": {
      "type": "string"
    },
    "agree": {
      "type": "boolean",
    },
    "signature": {
        "type": "string"
    }
  }
}
{
  "$id": "/test/schema",
  "type": "object",
  "required": [
    "label",
    "description",
    "agree"
  ],
  "properties": {
    "label": {
      "type": "string",
      "maxLength": 100
    },
    "description": {
      "type": "string"
    },
    "agree": {
      "type": "boolean"
    }
  }
}
import React, {type ReactElement} from 'react'
import { FormCreator, type IForm, type IFormValues } from '@axdspub/axiom-ui-forms'
import { type JSONSchema6 } from 'json-schema'

export default ExampleForm = ({schema}:{schema: JSONSchema7 }): ReactElement => {
    const formValueState = React.useState<IFormValues>({})
    const [formValues] = formValueState
    useEffect(()=>{
        // respond to change in formValues
    },[formValues])
    const errors = validateSchema(schema)
    const formConfig = errors === null
        ? schemaToFormObject(schema)
        : null

    return (
        <>{
            errors !== null
                ? <p>Schema errors: {{errors}}</p>
                : <SchemaFormCreator form={formConfig} formValueState={formValueState} >
        }</>
        
    )

}

Create a form using a schema, and modify it with a form config

import { SchemaFormCreator } from '@axdspub/axiom-ui-forms'
import { type JSONSchema6 } from 'json-schema'


const schema: JSONSchema6 = {
  properties: {
    text_field: {

    },
    numeric_field: {

    }

  }
}

const fieldOverrides: IFieldOverride[] = [
  {
    prop: 'text_field',
    label: 'This is my text field'
  }
]

Field definitions

These can be used to create a form config, or as partials to override a schema

root (all fields share these properties)

{
    "id": "fieldId",
    "label": "Field label",
    "description": "Field description",
    "multiple": false,
    "required": true,
    "conditions": {
        "dependsOn": "other_field_id",
        "value": "val"
    },
    "defaultValue": "initial value",
    "settings": {}
    
}

string fields

type:text

single line text field

{
    "placeHolder": "Example of field response"
}    

Enum select fields

type:select and type:radio

{
    "options": [
        {
            "label": "Option 1",
            "value": "option_1"
        },
        {
            "label": "Option 2",
            "value": "option_2"
        }
    ]
}

boolean

type:checkbox and type:boolean

checkbox field

number fields

type:number

date and time

type:date

{
    "constraints": {
        "minDate": "2023-02-01",
        "maxDate": "2024-06-01"
    }
}

type:time

{
    "constraints": {
        "minTime": "02:00:00",
        "maxTime": "18:30:00"
    }
}

type:datetime

{
    "constraints": {
        "minDateTime": "2023-02-01T00:00:00Z",
        "maxDateTime": "2024-06-01T00:00:00Z"
    }
}

type:object

  • skip_path: if true, id is not used to create path to child fields in output. Can not be true if multiple is true
  • fields: array of child fields
  • layout: type of layout for child form elements. Not fully supported yet.
{
    "skip_path": true,
    "layout": "horizontal",
    "fields": [
        
    ]
}

Field overrides

Field overrides must contain a prop property. This can reference an existing property from a schema. If it doesn't reference an existing property, a new property will be added to the form and the form output

Form overrides

Form overrides can have the following elements:

wizard_steps

These create a wizard interface

"wizard_steps": [
    {
        "id":"first_step",
        "order": 1,
        "label": "First step",
        "fields": [],
        "pages": []
    },
    {
        "id":"second_step",
        "order": 2,
        "label": "Second step",
        "fields": [],
        "pages": []
    }
]

pages

"pages": 

Tests

Uses vitest. Install vitest vscode plugin for extras

npm run test

Testing build locally

npm i spa-http-server -g
npm run build
cd build
http-server --push-state -p 8091 -o

Publish version to NPM

npm login --scope=@axdspub
npm publish --access public