GithubHelp home page GithubHelp logo

cooperhash / rc-input Goto Github PK

View Code? Open in Web Editor NEW

This project forked from react-component/input

0.0 0.0 0.0 2.45 MB

React Input Component

License: MIT License

Shell 0.14% JavaScript 0.91% TypeScript 98.10% Less 0.85%

rc-input's Introduction

rc-input ⌨️

NPM version npm download dumi build status Codecov Dependencies DevDependencies bundle size

Install

rc-input

Usage

import Input from 'rc-input';
import { render } from 'react-dom';

render(<Input placeholder="input" allowClear />, mountNode);

API

Property Type Default Description
prefixCls string rc-input
className string '' additional class name of input
style React.CSSProperties style properties of input
affixWrapperClassName string - className with 'rc-input-affix-wrapper'
groupClassName string - className with 'rc-input-group-wrapper'
wrapperClassName string - className with 'rc-input-wrapper'
addonAfter ReactNode - The label text displayed after (on the right side of) the input field
addonBefore ReactNode - The label text displayed before (on the left side of) the input field
allowClear boolean | { clearIcon: ReactNode } false If allow to remove input content with clear icon
bordered boolean true Whether has border style
defaultValue string - The initial input content
disabled boolean false Whether the input is disabled
id string - The ID for input
maxLength number - The max length
showCount boolean | { formatter: ({ value: string, count: number, maxLength?: number }) => ReactNode } false Whether show text count
prefix ReactNode - The prefix icon for the Input
suffix ReactNode - The suffix icon for the Input
type string text The type of input, see: MDN( use Input.TextArea instead of type="textarea")
value string - The input content value
onChange function(e) - Callback when user input
onPressEnter function(e) - The callback function that is triggered when Enter key is pressed

inputRef

const inputRef = useRef(null);

useEffect(() => {
  inputRef.current.focus();// the input will get focus
  inputRef.current.blur();// the input will lose focus
  console.log(inputRef.current.input);// The origin input element
}, []);
// ....
<Input ref={inputRef} />
Property Type Description
focus (options?: InputFocusOptions) => void The input get focus when called
blur () => void The input loses focus when called
input HTMLInputElement | null The origin input element

Development

npm install
npm start

License

rc-input is released under the MIT license.

rc-input's People

Contributors

afc163 avatar food-billboard avatar jarvisart avatar kiner-tang avatar lgtm-com[bot] avatar madccc avatar puchunjie avatar yoyo837 avatar yyz945947732 avatar zombiej 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.