React Component Input

1.8.0 · active · verified Sun Apr 19

rc-input is a foundational, unstyled React input component, designed to be highly customizable and often used as a building block for UI libraries like Ant Design. It provides core input functionalities, including features like clearable input. The current stable version is 1.8.0. It receives regular maintenance updates, though a strict release cadence isn't published. A key differentiator is its low-level nature, focusing purely on input logic without opinionated styling, making it highly adaptable. It provides full TypeScript support and manages common input behaviors such as value synchronization and focus handling. The package has a somewhat convoluted naming history, which developers should be aware of.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates basic usage of the Input component, including a clearable input, a textarea, and a readonly input.

import Input from 'rc-input';
import { createRoot } from 'react-dom/client';

const App = () => (
  <div>
    <Input placeholder="Basic input" allowClear />
    <br />
    <Input.TextArea placeholder="Textarea input" rows={4} />
    <br />
    <Input value="Readonly input" readOnly />
  </div>
);

const mountNode = document.getElementById('root');
if (mountNode) {
  const root = createRoot(mountNode);
  root.render(<App />);
} else {
  console.error('Mount node not found!');
}

view raw JSON →