1.0.3 • Published 4 years ago

p2pu-input-fields v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Input fields for P2PU projects

Requirements

  • Bootstrap CSS
  • React

Usage

Example

See demo/src/index.js for more examples

import React, { useState } from 'react'
import { InputWithLabel } from "p2pu-input-fields"

const Form = () => {
  const [content, setContent] = useState({})
  const handleChange = (newContent) => {
    setContent({
      ...content,
      ...newContent
    })
  }

  return(
    <div className="container">
      <InputWithLabel
        name="text-input-demo"
        label="Text input"
        value={content['text-input-demo']}
        handleChange={handleChange}
        required={true}
      />
    </div>
  )
}

All inputs receive the following props: | Prop | Description | | ----------- | ----------- | | label (required) | The label for the input | | name (required) | The string will be used as the name and ID for the input, as well as the key in the return value for handleChange | | value (required) | The value of the input | | handleChange (required) | The function called when the input value changes. Called with an object { [name]: value } | | required (optional) | When true will add an asterisk to the label and set the HTML input attribute as required | | classes (optional) | Classes to be applied to the wrapper div containing the label and input |

Certain inputs have additional props; check the propTypes for more information.

Development

To develop

npm install
npm start

To run the demo

npm start

To build

npm run build

To publish a new version

Bump version in package.json

npm login
npm publish

You'll need to right credentials to publish to p2pu-input-fields

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.27

4 years ago

0.5.26

4 years ago

0.5.25

4 years ago

0.5.24

5 years ago

0.5.23

5 years ago

0.5.22

5 years ago

0.5.21

5 years ago

0.5.20

5 years ago

0.5.19

5 years ago

0.5.18

5 years ago

0.5.17

5 years ago

0.5.16

5 years ago

0.5.15

5 years ago

0.5.14

5 years ago

0.5.13

5 years ago

0.5.12

5 years ago

0.5.11

5 years ago

0.5.10

6 years ago

0.5.9

6 years ago

0.5.8

6 years ago

0.5.7

6 years ago

0.5.6

6 years ago

0.5.5

6 years ago

0.5.4

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.0

6 years ago

0.4.8

6 years ago

0.4.7

6 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago