Description
React-input-autosize is a text input component for React that resizes itself to fit its current content. It wraps the input so it can measure the size of its value, and otherwise behaves much like a standard React input. You can install it from NPM and use it in a React build with a bundler such as Browserify, Rollup or webpack, or include the UMD build directly in a page if React is already loaded. The component is controlled: it depends on the value prop and does not support being used as an uncontrolled input. The project's README lists three gotchas. Styles are copied only when the component mounts, so changing the stylesheet later can cause the size to be measured wrongly; remounting the input or calling copyInputStyles() fixes this. The component injects a stylesheet that hides the clear indicator in Internet Explorer and Edge, which can conflict with some Content Security Policies, and custom font sizes must be passed to the component. A live demo is on the project's GitHub Pages site. The project is released under the MIT license.…
Highlights
- Text input that grows and shrinks with its content
- Install from NPM or use the UMD build in a page
- Controlled input driven by the value prop
- Documented gotchas for runtime styles, CSP and custom fonts
Ratings & Reviews
No ratings yet
Be the first to rate react-input-autosize.
People also visit

react-autosize-textarea
replacement for built-in textarea which auto resizes itself
react-input-autosize FAQ
What does react-input-autosize do?
It is a text input for React that resizes itself to the current content, behaving like a standard input otherwise.
How do I install it?
Install it from NPM and include it in your React build with a bundler such as webpack, Rollup or Browserify. A UMD build is also available as dist/AutosizeInput.js.
Can I use it as an uncontrolled input?
No. The component is controlled and depends on the value prop.
What if my styles change after mount?
Styles are copied only at mount, so remount the input with a new key or call copyInputStyles() after the styles change.
Does it work with a strict Content Security Policy?
The component injects a stylesheet by default, which some CSP policies block. You can pass injectStyles={false} and style the input yourself.
Is it free?
Yes. It is released under the MIT license by its author, Jed Watson.
Where can I see it working?
The project has a live demo at jedwatson.github.io/react-input-autosize, and examples can be run locally.
What are the best react-input-autosize alternatives?
Popular alternatives to react-input-autosize include react-textarea-autosize, react-textarea-autosize and react-autosize-textarea. See all react-input-autosize alternatives
















