1.0.3 • Published 5 years ago

p2pu-input-fields v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
5 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

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.27

5 years ago

0.5.26

5 years ago

0.5.25

5 years ago

0.5.24

6 years ago

0.5.23

6 years ago

0.5.22

6 years ago

0.5.21

6 years ago

0.5.20

6 years ago

0.5.19

6 years ago

0.5.18

6 years ago

0.5.17

7 years ago

0.5.16

7 years ago

0.5.15

7 years ago

0.5.14

7 years ago

0.5.13

7 years ago

0.5.12

7 years ago

0.5.11

7 years ago

0.5.10

7 years ago

0.5.9

7 years ago

0.5.8

7 years ago

0.5.7

7 years ago

0.5.6

7 years ago

0.5.5

7 years ago

0.5.4

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.0

7 years ago

0.4.8

7 years ago

0.4.7

7 years ago

0.4.6

7 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago