react-use-responsive-input
TypeScript icon, indicating that this package has built-in type declarations

2.0.10 • Public • Published

useResponsiveInput

npm (tag) npm bundle size NPM

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)}
        />
    )
}

Readme

Keywords

none

Package Sidebar

Install

npm i react-use-responsive-input

Weekly Downloads

46

Version

2.0.10

License

MIT

Unpacked Size

5.99 kB

Total Files

9

Last publish

Collaborators

  • andrewkrippner