react-use-responsive-input
v2.0.10
Published
[![npm (tag)](https://img.shields.io/npm/v/react-use-responsive-input?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/react-use-responsive-input) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-responsive-inp
Downloads
415
Readme
useResponsiveInput
useResponsiveInput is a React hook that makes any input component responsive to it's text's width.
Installation
npm
npm install react-use-responsive-input
Yarn
yarn add react-use-responsive-input
Example
import { useState } from 'react'
import useResponsiveInput from 'react-use-responsive-input'
const ResponsiveInput = () => {
const [value, setValue] = useState('')
const responsiveInputRef = useResponsiveInput()
return (
<input
ref={responsiveInputRef}
value={value}
onChange={e => setValue(e.target.value)}
/>
)
}