https://github.com/github/textarea-autosize
Autosizes textarea to size of it's contents.
https://github.com/github/textarea-autosize
decorator
Last synced: 4 months ago
JSON representation
Autosizes textarea to size of it's contents.
- Host: GitHub
- URL: https://github.com/github/textarea-autosize
- Owner: github
- License: mit
- Created: 2018-08-08T22:02:50.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-06-18T23:52:35.000Z (over 1 year ago)
- Last Synced: 2025-03-30T18:09:48.528Z (10 months ago)
- Topics: decorator
- Language: JavaScript
- Homepage:
- Size: 361 KB
- Stars: 98
- Watchers: 178
- Forks: 21
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Textarea Autosize
Autosizes textarea to size of its contents.
## Installation
```
$ npm install @github/textarea-autosize
```
## Usage
The autosizing behavior must be explicitly activated on the ``.
```js
import autosize from '@github/textarea-autosize'
autosize(document.querySelector('textarea.foo'))
```
Using a library like [selector-observer](https://github.com/josh/selector-observer), the behavior can automatically be applied to any textareas matching a class name.
```js
import {observe} from 'selector-observer'
import autosize from '@github/textarea-autosize'
observe('textarea.autosize', { subscribe: autosize })
```
## Browser support
- Chrome
- Firefox
- Safari
- Internet Explorer 11
- Microsoft Edge
## Development
```
npm install
npm test
```
## License
Distributed under the MIT license. See LICENSE for details.