text-input

v1.0.1arrow_drop_down
v1.0.1
v1.0.0
STATUS
Failing
DOWNLOADS
6
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
6 years ago
SIZE
N/A
Returns an object with properties that are relevant for the TextInput's textarea.
1 contributor
Install text-input as a package?
Copied
npm i @bit/tomlandau.belle.components.text-input
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
chevron_left
chevron_right

Returns an object with properties that are relevant for the TextInput’s textarea.

As the height of the textarea needs to be calculated valueLink can not be passed down to the textarea, but made available through this component.

Update hover & focus style for the speficied styleId.

TextInput component with great UX like autogrowing & handling states

Note on styling: Right now this component doen’t allow to change style after initialisation.

Note on resizing: If you fill a textarea only with spaces and the cursor reaches the right end it won’t break the line. This leads to unexpected behaviour for the automatic resizing.

This component was highly inspired by the great work from these guys

Generates the style-id & inject the focus & hover style.

Right after the component go injected into the DOM it should be resized.

Update the properties passed to the textarea and resize as with the new properties the height might have changed.

Remove a component’s associated styles whenever it gets removed from the DOM.

Prevent any newline (except allowNewLine is active) and pass the event to the onKeyDown property.

This is an optimization to avoid adding a newline char & removing it right away in the onUpdate callback.

Update the height and calls the provided change callback for onUpdate or valueLink.

In addition newline characters are replaced by spaces in the textarea value in case allowNewLine is set to false and newLine characters could be found.

Calculate the height and store the new height in the state to trigger a render.

Help and resources