All Projects → charlypoly → react-apollo-form

charlypoly / react-apollo-form

Licence: MIT license
Build React forms based on GraphQL APIs.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to react-apollo-form

React Apollo Form
Build React forms based on GraphQL APIs.
Stars: ✭ 178 (-8.72%)
Mutual labels:  apollo, forms, form, graphql-api
Rich Model Forms Bundle
Provides additional data mappers that ease the use of the Symfony Form component with rich models.
Stars: ✭ 198 (+1.54%)
Mutual labels:  forms, form
Redux Form
A Higher Order Component using react-redux to keep form state in a Redux store
Stars: ✭ 12,597 (+6360%)
Mutual labels:  forms, form
Final Form
🏁 Framework agnostic, high performance, subscription-based form state management
Stars: ✭ 2,787 (+1329.23%)
Mutual labels:  forms, form
Composable Form
Build type-safe composable forms in Elm
Stars: ✭ 179 (-8.21%)
Mutual labels:  forms, form
React Redux Form
Create forms easily in React with Redux.
Stars: ✭ 2,099 (+976.41%)
Mutual labels:  forms, form
Fui
Add CLI & form interface to your program. Docs: https://docs.rs/fui
Stars: ✭ 244 (+25.13%)
Mutual labels:  forms, form
Reactive forms
This is a model-driven approach to handling form inputs and validations, heavily inspired in Angular's Reactive Forms
Stars: ✭ 135 (-30.77%)
Mutual labels:  forms, form
periqles
React form library for Relay and Apollo
Stars: ✭ 124 (-36.41%)
Mutual labels:  apollo, forms
Villus
🏎 A tiny and fast GraphQL client for Vue.js
Stars: ✭ 378 (+93.85%)
Mutual labels:  apollo, graphql-api
Searchkit
GraphQL API & React UI components for Elasticsearch. The easiest way to build a great search experience
Stars: ✭ 4,338 (+2124.62%)
Mutual labels:  apollo, graphql-api
Plugin Graphql
Vuex ORM persistence plugin to sync the store against a GraphQL API.
Stars: ✭ 215 (+10.26%)
Mutual labels:  apollo, graphql-api
Fielder
A field-first form library for React and React Native
Stars: ✭ 160 (-17.95%)
Mutual labels:  forms, form
React Form
⚛️ Hooks for managing form state and validation in React
Stars: ✭ 2,270 (+1064.1%)
Mutual labels:  forms, form
Core
The Form Tools Core.
Stars: ✭ 156 (-20%)
Mutual labels:  forms, form
Form bloc
🔥 Dart and Flutter Package 🔥 Easy Form State Management using BLoC pattern 🔥 Wizard/stepper forms, asynchronous validation, dynamic and conditional fields, submission progress, serialization and more! 🔥
Stars: ✭ 239 (+22.56%)
Mutual labels:  forms, form
React Controlled Form
Flexible, Modular & Controlled Forms for React and Redux
Stars: ✭ 121 (-37.95%)
Mutual labels:  forms, form
Forms
📝 Simple form & survey app for Nextcloud
Stars: ✭ 127 (-34.87%)
Mutual labels:  forms, form
Vue Form Json Schema
Create forms using JSON schema. Bring your components!
Stars: ✭ 253 (+29.74%)
Mutual labels:  forms, form
Apollo
Meteor & Apollo integration
Stars: ✭ 87 (-55.38%)
Mutual labels:  apollo, graphql-api

<ApolloForm> https://img.shields.io/circleci/project/github/wittydeveloper/react-apollo-form.svg https://img.shields.io/npm/v/react-apollo-form.svg https://img.shields.io/npm/dt/react-apollo-form.svg

Build React forms based on GraphQL APIs.


The library is currently under active rewriting, please see this ticket for updates


https://s3.eu-west-2.amazonaws.com/github-oss/react-apollo-form/read-me-demo-preview.png


To get started more easily, please read Getting started: build a GraphQL Form in 5 minutes


Pre-requisites

  • apollo-codegen (globally)
  • react@^15
  • react-apollo@^15

Optionally

  • typescript@^2.8.4

Installation

Install package

  • install yarn add react-apollo-form

Add script to your project

  • add to your package.json, at the scripts section :
{
    "scripts": {
        "react-apollo-form": "react-apollo-form fetch-mutations <graphql_endpoint> <outpurDir>"
    }
}

This script will generated 3 files needed by <ApolloForm>:

  • schema.json (GraphQL Introspection Query result as JSON)
  • mutations.d.ts (all available mutations names as TypeScript type definition)
  • apollo-form-json-schema.json (GraphQL Schema as JSON Schema)

Tips: you can change the output directory of theses with the second argument or -o option


Usage

Once the files generated, we can setup a Form.

import * as React from 'react';
import gql from 'graphql-tag';
import { configure } from 'react-apollo-form';
import { client } from './apollo';
import { applicationFormTheme } from './core/forms/themes/application';


const jsonSchema = require('./core/apollo-form-json-schema.json');

export const ApplicationForm = configure<ApolloFormMutationNames>({
    // tslint:disable-next-line:no-any
    client: client as any,
    jsonSchema,
    theme: applicationFormTheme
});

<ApplicationForm
    config={{
        mutation: {
            name: 'create_todo',
            document: gql`mutation {...}`
        }
    }}
    data={{}}
/>

API

ApolloForm is based on the amazing Mozilla library react-jsonschema-form. Most of the questions regarding JSON Schema, validations or rendering are in react-jsonschema-form documentation

To get started more easily, please read Getting started: build a GraphQL Form in 5 minutes

The following subjects are specific to ApolloForm:


Q&A

  • Can I make ApolloForm works with many GraphQL endpoints?

Yes, just setup multiple scripts in your project package.json with one output folder per endpoint, then just configure a "component form" for each endpoint

  • Where can I find some documentation about widgets, fields or theming in general?

Please take a look at the react-jsonschema-form documentation that will answers 90% of the rendering questions. If not, please take a look at Theming


Architecture

General

The idea is to build forms using mutations from the GraphQL API.

ApolloForm is "just" a wrapper around react-jsonschema-form.

It brings some "embed" features:

  • JSON schema generation from GraphQL Schema
  • conditionals forms
  • form rendering customisation with render props
  • build JSON Schema with functions (with functional-json-schema)

GraphQL to JSON Schema

See graphql-2-json-schema package.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].