Giter VIP home page Giter VIP logo

react-pretty-input's Introduction

react-pretty-input

Overview

A pretty input and textarea form fields for React projects.

NPM version Build Status Coverage Status npm download MIT License

Installation

react-pretty-input

Usage

ES6 import:

import { PrettyInputText } from 'react-pretty-input';
// In JSX
<PrettyInputText name="email" labelText="Email Address" errorValue="Invalid Email Address" isRequired />

// In vanilla JS
React.createElement(PrettyInputText, { name: 'email', labelText: 'Email Address', errorValue: 'Invalid Email Address', isRequired: true});

PrettyInputText Props

name (required) (type: string)

This prop is the name attribute of the generated input tag.

labelText (required) (type: string)

This prop is the description string of the field. It's used to show the placeholder and the label of the input to describe it.

inputValue (optional) (type: string)

This prop is the default value of the component.

errorValue (optional) (type: string) (default: 'Error')

This prop is the description string of error occurred in the field. It's used to show the error in the label to describe it.

size (optional) (type: integer) (default: 50)

This prop is used to limit the input string length of the field.

isRequired (optional) (type: boolean) (default: false)

This prop is used to indicate if the input string of the field is required. If the prop value is true and the field is empty an error is showed in label and border field.

onValidation (optional) (type: function) (default: inputValue => true)

This prop is used to pass a callback function to validate de input value of the component. This function must return a boolean value.

onChange (optional) (type: function) (default: null)

This prop is used to pass a callback function invoked on input text change.

onKeyPress (optional) (type: function) (default: null)

This prop is used to pass a callback function invoked on every key press event.

labelColor (optional) (type: string) (default: #0069ff)

This prop is used to set the color of the label.

backgroundColor (optional) (type: string) (default: #fff)

This prop is used to set the background color of the component.

width (optional) (type: integer) (default: 200)

This prop is used to set the css width of the component.

PrettyInputTextArea Props

name (required) (type: string)

This prop is the name attribute of the generated input tag.

labelText (required) (type: string)

This prop is the description string of the field. It's used to show the placeholder and the label of the input to describe it.

inputValue (optional) (type: string)

This prop is the default value of the component.

size (optional) (type: integer) (default: 50)

This prop is used to limit the input string length of the field.

isRequired (optional) (type: boolean) (default: false)

This prop is used to indicate if the input string of the field is required. If the prop value is true and the field is empty an error is showed in label and border field.

onChange (optional) (type: function) (default: null)

This prop is used to pass a callback function invoked on input text change.

onKeyPress (optional) (type: function) (default: null)

This prop is used to pass a callback function invoked on every key press event.

labelColor (optional) (type: string) (default: #0069ff)

This prop is used to set the color of the label.

backgroundColor (optional) (type: string) (default: #fff)

This prop is used to set the background color of the component.

width (optional) (type: integer) (default: 200)

This prop is used to set the css width of the component.

Contributing

Use Github issues for feature requests and bug reports. We actively accept pull requests.

License

MIT

react-pretty-input's People

Contributors

oscarmartingonzalez avatar

Stargazers

MCARMEN PARRON avatar

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.