New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@rc-component/input

Package Overview
Dependencies
Maintainers
5
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rc-component/input

React input component

Source
npmnpm
Version
1.3.1
Version published
Weekly downloads
2.2M
28.36%
Maintainers
5
Weekly downloads
 
Created
Source

@rc-component/input ⌨️

NPM version npm download build status Codecov bundle size dumi

Install

@rc-component/input

Usage

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

render(<Input placeholder="input" allowClear />, mountNode);
import { TextArea } from '@rc-component/input';
import { render } from 'react-dom';

render(<TextArea autoSize showCount />, mountNode);

API

PropertyTypeDefaultDescription
prefixClsstringrc-input
classNamestring''additional class name of input
styleReact.CSSPropertiesstyle properties of input
affixWrapperClassNamestring-className with '@rc-component/input-affix-wrapper'
groupClassNamestring-className with '@rc-component/input-group-wrapper'
wrapperClassNamestring-className with '@rc-component/input-wrapper'
addonAfterReactNode-The label text displayed after (on the right side of) the input field
addonBeforeReactNode-The label text displayed before (on the left side of) the input field
allowClearboolean | { clearIcon: ReactNode }falseIf allow to remove input content with clear icon
borderedbooleantrueWhether has border style
defaultValuestring-The initial input content
disabledbooleanfalseWhether the input is disabled
idstring-The ID for input
maxLengthnumber-The max length
showCountboolean | { formatter: ({ value: string, count: number, maxLength?: number }) => ReactNode }falseWhether show text count
prefixReactNode-The prefix icon for the Input
suffixReactNode-The suffix icon for the Input
typestringtextThe type of input, see: MDN (use the named TextArea export instead of type="textarea")
valuestring-The input content value
onChangefunction(e)-Callback when user input
onPressEnterfunction(e)-The callback function that is triggered when Enter key is pressed

TextArea

rc-textarea has been migrated into @rc-component/input. Use the named TextArea export for all textarea-related features.

import { TextArea } from '@rc-component/input';

<TextArea showCount maxLength={100} />;
<TextArea allowClear autoSize />;
PropertyTypeDefaultDescription
prefixClsstringrc-textarea
classNamestring''additional class name of textarea
styleReact.CSSProperties-style properties of textarea
autoSizeboolean | object-Height autosize feature, can be set to true|false or an object { minRows: 2, maxRows: 6 }
allowClearboolean | { clearIcon }falseIf allow to remove textarea content with clear icon
showCountboolean | { formatter }falseWhether show text count
countCountConfig-Custom count strategy / max / exceed formatter
onPressEnterfunction(e)-The callback function that is triggered when Enter key is pressed
onResizefunction({ width, height })-The callback function that is triggered when resize

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} />;
PropertyTypeDescription
focus(options?: InputFocusOptions) => voidThe input get focus when called
blur() => voidThe input loses focus when called
inputHTMLInputElement | nullThe origin input element

textareaRef

const textareaRef = useRef(null);

useEffect(() => {
  textareaRef.current.focus();
  textareaRef.current.blur();
  console.log(textareaRef.current.resizableTextArea);
}, []);

<TextArea ref={textareaRef} />;
PropertyTypeDescription
focus() => voidThe textarea get focus when called
blur() => voidThe textarea loses focus when called
resizableTextAreaResizableTextAreaRefWrapped resizable textarea instance
nativeElementHTMLElement | nullThe outer holder element or textarea DOM

Development

npm install
npm start

License

@rc-component/input is released under the MIT license.

Keywords

react

FAQs

Package last updated on 25 May 2026

Related posts