1.0.3 • Published 1 year ago

react-textarea-counter v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
1 year ago

react-textarea-counter

NPM Code Style Build Status

Basic textarea character counter React component.

Installation

npm i react-textarea-counter --save

Usage

import React from 'react';
import TextareaCounter from 'react-textarea-counter';

export default function MyComponent() {
  return <TextareaCounter countLimit={25} initialValue="Hello World!" />;
}

Props

PropertyTypeDefaultDescription
showCountbooltrueIf you want to show the counter or to hide it.
countLimitnumber25The max number of characters on the counter.
countDirectionstringascIf it should count from the countLimit to zero set to desc otherwise set it to asc.
countPositionstringrightPosition of the counter on the bottom of the textarea.
shouldTruncatestringtrueIf you want to allow the user to insert more characters than the countLimit set to false.
initialValuestringThe default initial value on the textarea element.
rowsnumber6The number of rows of the textarea element.
resizestringverticalResize attribute of the textarea element. Can be none, both, horizontal or vertical.
placeholderstringPlaceholder of the textarea element.
onChangefuncCallback function on the onChange event.
onFocusfuncCallback function on the onFocus event.
onBlurfuncCallback function on the onBlur event.
requiredboolfalseRequired attribute of the textarea element.
disabledboolfalseDisabled attribute of the textarea element.

License

Open source under the terms of the MIT License.

Made by Diogo Capela.

1.0.2

1 year ago

1.0.1

1 year ago

1.0.3

1 year ago

1.0.0

4 years ago