@govuk-frederic/countdown-text-area
v0.2.0
Published
TextArea which accepts a maxlength prop and renders a TextAreaField, limits characters and styles accordingly.
Downloads
33
Readme
CountdownTextArea
Import
import CountdownTextArea from '@govuk-frederic/countdown-text-area';Usage
Simple
import manageState from 'manage-state';
const ManagedCountdownTextarea = manageState(CountdownTextArea, {
changeEvent: true,
propsToState: ['value'],
});
<ManagedCountdownTextarea />With maxlength (150)
import manageState from 'manage-state';
const ManagedCountdownTextarea = manageState(CountdownTextArea, {
changeEvent: true,
propsToState: ['value'],
});
<ManagedCountdownTextarea noMaxLengthAttr maxLength={150} />With maxlength (100) and positiveOnly
import manageState from 'manage-state';
const ManagedCountdownTextarea = manageState(CountdownTextArea, {
changeEvent: true,
propsToState: ['value'],
});
<ManagedCountdownTextarea maxLength={100} positiveOnly />Properties
Prop | Required | Default | Type | Description
:--- | :------- | :------ | :--- | :----------
maxLength | | undefined | number |
noMaxLengthAttr | | false | bool |
positiveOnly | | false | bool |
