Giter VIP home page Giter VIP logo

react-input-collection's Introduction

React Input UI Collection


DEMO Note: React version 16.8.0


Inspiration from codrops

Form inputs offer a great opportunity to add some subtle and interesting effects to a web page. They are elements that your user will interact with at some point and making them fun to use can enhance the experience. We are used to the default form resembling its paper counterpart but in the digital world we can be more creative

List of components :

  1. InputAkira
  2. InputIchiro
  3. InputJiro
  4. InputKuro
  5. InputMadoka
  6. InputMaterial
  7. InputMinoru
  8. InputNao
  9. InputSoda
  10. InputYoko

Example

 import React, {useState} from 'react';
 import InputAkira from 'react-input-ui/collection/akira';
 
 function App() {
   const [value, setValue] = useState('');

   return (
     <InputAkira
       label={'Akira UI'}
       placeholder='type...'
       onChanhe={setValue}
       value={value}
     />
   )
 }

Example with custom style

If you need change style for label or input tag, just use property:

labelStyle inputStyle

in other cases: style className

 import React, {useState} from 'react';
 import InputAkira from 'react-input-ui/collection/akira';
 
 function App() {
   const [value, setValue] = useState('');
 
   return (
     <InputAkira
       label={'Akira UI'}
       placeholder='type...'
       onChanhe={setValue}
       value={value}
       style={{margin: '25px'}}
       className={'custom-class'}
       labelStyle={{fontSize: '18px'}}
       inputStyle={{fontSize: '21px'}}
     />
   )
 }

Example for validation field

If field not valid set property error to true

If field valid set property error to false

If don't need validation set property error to null

 import React, {useState} from 'react';
 import InputAkira from 'react-input-ui/collection/akira';
 
 function App() {
   const [value, setValue] = useState('');
   const [error, setError] = useState(null);
  
   const handleChange = e => {
     setValue(e.target.value);
   };

   const handleFocus = () => {
     setError(null);
   };

   const handleSubmit = () => {
     setError(!!value.length > 2);
   }
   
   return (
     <div>
       <InputAkira
         label={'Akira UI'}
         placeholder='type...'
         onChange={handleChange}
         onFocus={handleFocus}
         value={value}
         error={error}
       />
       <button onClick={handleSubmit}>SUBMIT</button>
     </div>
   )
 }

Example for customizing theme

Theme has 4 property:

Theme property:
activeTextColor
focusColor
hoverColor
mainColor

To change them use theme method

 import React, {useState} from 'react';
 import InputAkira, {theme} from 'react-input-ui/collection/akira';

 function App() {
   const [value, setValue] = useState('');
  
   const handleSetTheme = () => {
     theme({
       activeTextColor: '#101010',
       focusColor: '#2196f3',
       hoverColor: '#252525',
       mainColor: '#727272',
     })
   };
   
   return (
     <div>
       <InputAkira
         label={'Akira UI'}
         placeholder='type...'
         onChanhe={setValue}
         value={value}
       />
     <button onClick={handleSetTheme}>CHANGE THEME</button>
     </div>
   )
 }

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.