包详细信息

react-textarea-auto-witdth-height

wwf4109187015.5kMIT1.0.3

Fully auto size react textarea component that can grow with content both in width and height

autosize, grow, react, autowidth

自述文件

react-textarea-auto-witdth-height

codecov License: MIT semantic-release: angular Github All Releases example workflow

An easy to use replacement for textarea that can automatically resizes both horizontally and vertically as content changes.

  import { AutoTextArea } from 'react-textarea-auto-witdth-height'

  const somePlace = () => (
    <div>
      <AutoTextArea/>
    </div>
  )

Demo

https://react-textarea-auto-witdth-height-8j96.vercel.app/

Install

npm i react-textarea-auto-witdth-height

Props

Props are almost identical as native textarea, except rows and cols are not supported, please use min-height and max-height to style the component instead.

FAQ

How to focus

Reference the inner textarea

<TextareaAutosize ref={(ref) => (this.current = ref)} />

Then focus on the ref

this.current.focus();

更新日志

1.0.3 (2024-07-14)

Bug Fixes

  • size incorrect after manually update value (1e727ff)

1.0.2 (2024-05-26)

Bug Fixes

1.0.1 (2024-05-26)

Bug Fixes

  • customized box sizing cause incorrect size (71dd478)

1.0.0 (2024-05-26)

Bug Fixes

  • size incorrect when have padding and margin styles (32948c3)