Giter Site home page Giter Site logo

react-typeform's Introduction

react-typeform Build Status GitHub version npm version

Description

Renders each component at a time with a next button, and when all components are traversed then all components are shown at once for review with a submit button.

Installation

npm install react-typeform --save

Setup for typeform

Component.jsx

<div>
  ...Your individual component here
</div>

Properties

children (Required)

The individual components to be shown one by one

onSubmit

Function that executes when submit button is clicked

submitBtnText

Text to be displayed for submit button Default: Submit

submitBtnClass

Classname for submit button

nextBtnText

Text to be displayed for next button Default: Next

nextBtnClass

Classname for next button

nextBtnOnClick

Function that executes when next button is clicked

backBtnText

Text to be displayed for back button Default: Back

backBtnClass

Classname for back button

backBtnOnClick

Function that executes when back button is clicked

showReviewView

Boolean that sets whether to show a review view as the final step Default: true

Example

import React from 'react';
import TypeForm from 'react-typeform';

class TypeFormComponent extends React.Component {

  submit() {
    // Call your submit function here
  }

  render() {
    return(
      {/** You can wrap this into your favourite form
        * But use the onSubmit function to call function that executes on click
        */}
      <TypeForm
        onSubmit={this.submit}
      >
        <Component1 />
        <Component2 />
        ...
      </TypeForm>
      );
  }
}

export default TypeFormComponent;

License

MIT

react-typeform's People

Contributors

festinalent3 avatar jaypatel24 avatar mcclowes avatar mohithg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-typeform's Issues

Cannot read property 'element' of undefined

Hi!

I can't get this to work.
Keep getting this error just for importing the module:

Uncaught TypeError: Cannot read property 'element' of undefined.

app.js:

class FormSubscribe extends React.Component {
  constructor(props) {
    super(props);
  }

  /**
   * Handles form submition
   */
  submit(event) {
    ...
  }

  render() {
    return (
      <TypeForm onSubmit={this.submit}>
        <Input type="text" label="Nome" name="name" required/>
      </TypeForm>
    )
  }
}

component.js

export class Input extends React.Component {
  constructor(props) {
    super(props);
  }

  render() {
    return(
      <div className="form-group">
        <label>{this.props.label} {this.props.required ? <span>*</span> : ''}</label>
        <input className="form-control" type={this.props.type} name={this.props.name} value={this.props.value} required={this.props.required}/>
      </div>
    )
  }
}

Where the prop tfStyle comes anyway?
If you can provided a full example it would be great!

Thanks!

back button support?

Hi,

Wondering if you'd consider supporting a native back button with all the support the next button has? It'd be really useful for these types of forms. I might have to fork and make one myself for now or create a PR sometime.

thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.