Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rjsf/core

Package Overview
Dependencies
Maintainers
2
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjsf/core

A simple React component capable of building HTML forms out of a JSON schema.

  • 5.21.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
278K
decreased by-22.38%
Maintainers
2
Weekly downloads
 
Created

What is @rjsf/core?

@rjsf/core is a React library for building forms from JSON schema. It provides a simple way to create and manage forms in React applications by leveraging JSON schema definitions.

What are @rjsf/core's main functionalities?

Form Creation

This feature allows you to create a form based on a JSON schema. The schema defines the structure and validation rules for the form fields.

const Form = require('@rjsf/core').default;
const schema = {
  title: "A registration form",
  type: "object",
  required: ["firstName", "lastName"],
  properties: {
    firstName: {type: "string", title: "First name", default: "Chuck"},
    lastName: {type: "string", title: "Last name"},
    age: {type: "integer", title: "Age"}
  }
};

const App = () => (
  <Form schema={schema} />
);

Custom Widgets

This feature allows you to use custom widgets for form fields. You can define your own React components to be used as widgets in the form.

const { default: Form } = require('@rjsf/core');
const CustomWidget = (props) => {
  return (
    <input type="text" value={props.value} onChange={(event) => props.onChange(event.target.value)} />
  );
};

const schema = {
  title: "A form with custom widget",
  type: "object",
  properties: {
    customField: {type: "string", title: "Custom Field"}
  }
};

const uiSchema = {
  customField: {
    "ui:widget": CustomWidget
  }
};

const App = () => (
  <Form schema={schema} uiSchema={uiSchema} />
);

Form Validation

This feature allows you to define validation rules in the JSON schema. The form will automatically validate the input based on these rules.

const { default: Form } = require('@rjsf/core');
const schema = {
  title: "A form with validation",
  type: "object",
  properties: {
    age: {type: "integer", title: "Age", minimum: 18}
  }
};

const App = () => (
  <Form schema={schema} />
);

Other packages similar to @rjsf/core

Keywords

FAQs

Package last updated on 02 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc