1.1.0 • Published 3 years ago

@idot-digital/advanced-input v1.1.0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
3 years ago

advanced-input

React inputs, validating regexp, chars and more. Able to switch between small inputs and textareas.

NPM JavaScript Style Guide

Install

npm install --save advanced-input

Usage

import React, { Component } from 'react'

import AdvancedInput from 'advanced-input'
import 'advanced-input/dist/index.css'

class Example extends Component {
  render() {
    return (
      <AdvancedInput
        defaultValue={'#'}
        value={'test'}
        valueSelection={{ start: 2 }}
        useTextareaAtLength={20}
        regexp={/#([a-fA-F0-9]{3}){1,2}/}
        allowedChars={/#|[a-fA-F0-9]/}
        dontValidateDuringInput
        callback={(input) => console.log(input)}
        errorCallback={() => console.log('error')}
        extendToTextareaOnLinebreak
        placeholder='Some text'
        floatingPlaceholder
      />
    )
  }
}

License

UNLICENSED © @idot-digital