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 🙏

© 2024 – Pkg Stats / Ryan Hefner

prospectus

v0.0.3

Published

Object to HTML form generator for React Aplications

Downloads

8

Readme

Prospectus

Vantage-auth

Installation

Just install the dependency and start using

npm i prospectus or yarn add prospectus

How to import

After installing the dependency, just import the components you need

import Prospectus from "prospectus";

Usage

This example shows how to user prospectus to render a form and html from a object

import Prospectus from  "prospectus";
const formObject = {
	form: {
		//check bellow for more properties
	},
	elements: [
		//check bellow for more properties
    ]
}
<Prospectus
	data={formObject}
	renderForm={true}
/>

Get HTML code from Object

The example below shows how to collect/get the html code generated by the object. Still in this example it shows the functionality of not rendering the form visually, this can be useful for applications like editors that only need the generated code.

import Prospectus from "prospectus";
const formObject = {
  form: {
    //check bellow for more properties
  },
  elements: [
    //check bellow for more properties
  ]
};
export default class App extends Component {
  getFormHtml = html => {
    console.log(html);
  };
  render() {
    return (
      <div>
        <Prospectus
          data={formObject}
          renderToHTML={this.getFormHtml}
          renderForm={false}
        />
      </div>
    );
  }
}

Form Properties

The properties of the form are the basic attributes of a html form, these are not mandatory

import Prospectus from  "prospectus";
const formObject = {
	form: {
	    action: "https://example.com",
        method: "post",
        target: "_blank"
    }
    ...
}

Element Properties

The properties can be different, what is inside the "props" is only generic attributes of the html tags so you can add what you want, you just need to indicate the type of element. More examples of element below.

import Prospectus from  "prospectus";
const formObject = {
    ...
	elements: [
        {
          element: "text", //radio //select //button //textarea
          props: {
            type: "text",
            id: "name",
            name: "name",
            label: "What's your name?",
            className: "form-control",
            required: true
            //more generic input tag properties from pure html
          }
        }
    ]
}

License

MIT © vacom